****Vi-SPIA DATA ANALYSIS

**Covariate Comparisons

gl all_cov "age_res educat_res hh_size num_child  y_edu_head max_edu_hh num_prod_ad land_bl pre_ce_07 a_pca_07 soc_07_avg erosion_07_avg _hh_loc_altitude hh_dist_tarma res_female res_christ res_luhya res_married res_spo_out res_widow res_head res_spo_head res_healthy literate_res school_res official_role_res res_farmer res_busi res_employ r_tech_skill hh_farm_07 hh_lstock_07 hh_bus_07 hh_emp_07 irrig_07 head_prod elder_hh elder_headed fem_headed lit_adult f_lit_adult head_lit hh_on_road lnd_title_07 lnd_self_07_2"


**compare binary respondent and household characteristics using prtest

gl bin_char "res_female res_christ res_luhya res_married res_spo_out res_widow res_head res_spo_head res_healthy literate_res school_res official_role_res res_farmer res_busi res_employ r_tech_skill hh_farm_07 hh_lstock_07 hh_bus_07 hh_emp_07 irrig_07 head_prod elder_hh elder_headed fem_headed lit_adult f_lit_adult head_lit hh_on_road lnd_title_07 lnd_self_07_2"

**first compare all HHs in program and non-program areas
eststo clear
eststo, t("program mean"): qui mean $bin_char  if prog_area==1 
eststo, t("non_program mean"): qui mean $bin_char if prog_area==0 
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\bin_char_means_program.rtf", cells(b(f(2) l(Mean))) lab nostar mti nonum gaps  r

eststo clear
eststo, t("program vs. non-program mean"): estpost prtest $bin_char, by (prog_area_r) q
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\bin_char_prtests_program.rtf", r   cells(b(star fmt(a2))   z(par))  starl(* 0.1 ** 0.05 *** 0.01) mti nogaps lab


***net differences after controling for county

eststo clear
local bin_char  res_female res_christ res_luhya res_married res_spo_out res_widow res_head res_spo_head res_healthy literate_res school_res official_role_res res_farmer res_busi res_employ r_tech_skill hh_farm_07 hh_lstock_07 hh_bus_07 hh_emp_07 irrig_07 head_prod elder_hh elder_headed fem_headed lit_adult f_lit_adult head_lit hh_on_road lnd_title_07 lnd_self_07_2

foreach var of local bin_char {
dprobit `var' prog_area county  
eststo
}
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\bin_char_net_coun_dif.csv",  r wide modelwidth(4) b(a2) starl(* 0.1 ** 0.05 *** 0.01) nogaps


***net differences after controling for sampling zone
**create dummies for each zone, so that dprobit can be used
g samp_z_1 = (zone==1)
g samp_z_2 = (zone==2)
g samp_z_3 = (zone==3)
g samp_z_4 = (zone==4)

eststo clear
local bin_char  res_female res_christ res_luhya res_married res_spo_out res_widow res_head res_spo_head res_healthy literate_res school_res official_role_res res_farmer res_busi res_employ r_tech_skill hh_farm_07 hh_lstock_07 hh_bus_07 hh_emp_07 irrig_07 head_prod elder_hh elder_headed fem_headed lit_adult f_lit_adult head_lit hh_on_road lnd_title_07 lnd_self_07_2

foreach var of local bin_char {
dprobit `var' prog_area samp_z_1 samp_z_2 samp_z_3 samp_z_4 
eststo
}
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\bin_char_net_zone_dif.csv",  r wide modelwidth(4) b(a2) starl(* 0.1 ** 0.05 *** 0.01) nogaps


***do specifically for female respondents

eststo clear
local bin_char   res_christ res_luhya res_married res_spo_out res_widow res_head res_spo_head res_healthy literate_res school_res official_role_res res_farmer res_busi res_employ r_tech_skill hh_farm_07 hh_lstock_07 hh_bus_07 hh_emp_07 irrig_07 head_prod elder_hh elder_headed fem_headed lit_adult f_lit_adult head_lit hh_on_road lnd_title_07 lnd_self_07_2 

foreach var of local bin_char {
dprobit `var' prog_area samp_z_1 samp_z_2 samp_z_3 samp_z_4 if res_female==1
eststo
}
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\bin_char_net_zone_female.csv",  r wide modelwidth(4) b(a2) starl(* 0.1 ** 0.05 *** 0.01) nogaps nolabel

***Short listed covariates: res_married res_widow res_head hh_lstock_07 hh_emp_07 hh_on_road lnd_self_07_2   

***do specifically for those affected by shock

eststo clear
local bin_char res_female res_christ res_luhya res_married res_spo_out res_widow res_head res_spo_head res_healthy literate_res school_res official_role_res res_farmer res_busi res_employ r_tech_skill hh_farm_07 hh_lstock_07 hh_bus_07 hh_emp_07 irrig_07 head_prod elder_hh elder_headed fem_headed lit_adult f_lit_adult head_lit hh_on_road lnd_title_07 lnd_self_07_2 

foreach var of local bin_char {
dprobit `var' prog_area samp_z_1 samp_z_2 samp_z_3 samp_z_4 if cop_stra !=.
eststo
}
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\bin_char_net_zone_dif_cop_strat.csv",  r wide modelwidth(4) b(a2) starl(* 0.1 ** 0.05 *** 0.01) nogaps nolabel

***Short listed covariates: res_female res_head  res_spo_head r_tech_skill  hh_lstock_07 hh_bus_07  hh_emp_07 elder_headed lnd_self_07_2   

***do specifically for those affected by shock & female

eststo clear
local bin_char  res_christ res_luhya res_married res_spo_out res_widow res_head res_spo_head res_healthy literate_res school_res official_role_res res_farmer res_busi res_employ r_tech_skill hh_farm_07 hh_lstock_07 hh_bus_07 hh_emp_07 irrig_07 head_prod elder_hh elder_headed fem_headed lit_adult f_lit_adult head_lit hh_on_road lnd_title_07 lnd_self_07_2 

foreach var of local bin_char {
dprobit `var' prog_area samp_z_1 samp_z_2 samp_z_3 samp_z_4 if cop_stra !=. & res_female==1
eststo
}
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\bin_char_net_zone_dif_cop_strat_res_female.csv",  r wide modelwidth(4) b(a2) starl(* 0.1 ** 0.05 *** 0.01) nogaps nolabel

***Short listed covariates: res_married res_widow res_head hh_lstock_07 hh_bus_07 lnd_self_07_2   

***do specifically for dairy producers

eststo clear
local bin_char  res_female res_christ res_luhya res_married res_spo_out res_widow res_head res_spo_head res_healthy literate_res school_res official_role_res res_farmer res_busi res_employ r_tech_skill hh_farm_07 hh_lstock_07 hh_bus_07 hh_emp_07 irrig_07 head_prod elder_hh elder_headed fem_headed lit_adult f_lit_adult head_lit hh_on_road lnd_title_07 lnd_self_07_2 

foreach var of local bin_char {
probit `var' prog_area samp_z_1 samp_z_2 samp_z_3 samp_z_4 if dar_prod ==1
eststo
}
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\bin_char_net_zone_dif_dar_prod.csv",  r wide modelwidth(4) b(a2) starl(* 0.1 ** 0.05 *** 0.01) nogaps nolabel

***Short listed covariates: res_female res_head res_spo_head hh_lstock_07 head_prod elder_headed lnd_self_07_2  


***Do it for HHs with children sec age
eststo clear
local bin_char  res_female res_christ res_luhya res_married res_spo_out res_widow res_head res_spo_head res_healthy literate_res school_res official_role_res res_farmer res_busi res_employ r_tech_skill hh_farm_07 hh_lstock_07 hh_bus_07 hh_emp_07 irrig_07 head_prod elder_hh elder_headed fem_headed lit_adult f_lit_adult head_lit hh_on_road lnd_title_07 lnd_self_07_2 

foreach var of local bin_char {
probit `var' prog_area samp_z_1 samp_z_2 samp_z_2 samp_z_4 if edu_prog !=.
eststo
}
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\bin_char_net_zone_dif_edu_prog.csv",  r wide modelwidth(4) b(a2) starl(* 0.1 ** 0.05 *** 0.01) nogaps nolabel

**shortlisted covariates: res_head res_employ r_tech_skill hh_lstock_07 elder_headed lnd_self_07_2   

***Do it for HHs with school age children
eststo clear
local bin_char  res_female res_christ res_luhya res_married res_spo_out res_widow res_head res_spo_head res_healthy literate_res school_res official_role_res res_farmer res_busi res_employ r_tech_skill hh_farm_07 hh_lstock_07 hh_bus_07 hh_emp_07 irrig_07 head_prod elder_hh elder_headed fem_headed lit_adult f_lit_adult head_lit hh_on_road lnd_title_07 lnd_self_07_2 

foreach var of local bin_char {
probit `var' prog_area samp_z_1 samp_z_2 samp_z_2 samp_z_4 if edu_spe !=.
eststo
}
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\bin_char_net_zone_dif_edu_spe.csv",  r wide modelwidth(4) b(a2) starl(* 0.1 ** 0.05 *** 0.01) nogaps nolabel

**shortlisted covariates: res_female res_head res_spo_head res_farmer res_employ r_tech_skill hh_lstock_07 elder_headed hh_on_road lnd_self_07_2   

***Compare continuous HH characteristics between program and non_programme area 
gl con_char "age_res educat_res hh_size num_child num_adult y_edu_head max_edu_hh num_prod_ad land_bl pre_ce_07 a_pca_07 soc_07_avg erosion_07_avg _hh_loc_altitude hh_dist_tarma"

eststo clear
eststo, t("program mean"):  mean $con_char  if prog_area==1 
eststo, t("non-program mean"):  mean $con_char  if prog_area==0 
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\con_char_means.rtf", cells(b(f(2) l(Mean))) lab nostar mti nonum  r gaps

***t-test 
eststo clear
eststo, t("Program vs. non-program mean"): estpost ttest $con_char , by (prog_area_r) q
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\con_char_tests.rtf", r   cells(b(star fmt(a2))   z(par))  starl(* 0.1 ** 0.05 *** 0.01) mti nogaps lab

***net differences after controling for site
eststo clear
local con_char  age_res educat_res hh_size num_child num_adult y_edu_head max_edu_hh  num_prod_ad  land_bl pre_ce_07 a_pca_07 soc_07_avg erosion_07_avg  _hh_loc_altitude hh_dist_tarma 

foreach var of local con_char {
reg `var' prog_area county
eststo
}
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\con_char_net_coun_dif.csv",  r wide modelwidth(4) b(a2) starl(* 0.1 ** 0.05 *** 0.01) nogaps

eststo clear
local con_char  age_res educat_res hh_size num_child num_adult y_edu_head max_edu_hh  num_prod_ad  land_bl pre_ce_07 a_pca_07 soc_07_avg erosion_07_avg _hh_loc_altitude hh_dist_tarma 

foreach var of local con_char {
reg `var' prog_area samp_z_1 samp_z_2 samp_z_3 samp_z_4 
eststo
}
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\con_char_net_zone_dif.csv",  r wide modelwidth(4) b(a2) starl(* 0.1 ** 0.05 *** 0.01) nogaps


***specifically for those female respondents

eststo clear
local con_char  age_res educat_res hh_size num_child num_adult y_edu_head max_edu_hh  num_prod_ad  land_bl pre_ce_07 a_pca_07 soc_07_avg erosion_07_avg _hh_loc_altitude hh_dist_tarma 

foreach var of local con_char {
reg `var' prog_area samp_z_1 samp_z_2 samp_z_3 samp_z_4 if res_female==1
eststo
}
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\con_char_net_zone_dif_female.csv",  r wide modelwidth(4) b(a2) starl(* 0.1 ** 0.05 *** 0.01) nogaps

***shortlisted cov: max_edu_hh  soc_07_avg _hh_loc_altitude 


***specifically for those HHs that experienced shock

eststo clear
local con_char  age_res educat_res hh_size num_child num_adult y_edu_head max_edu_hh  num_prod_ad  land_bl pre_ce_07 a_pca_07 soc_07_avg erosion_07_avg _hh_loc_altitude hh_dist_tarma 

foreach var of local con_char {
reg `var' prog_area samp_z_1 samp_z_2 samp_z_3 samp_z_4 if cop_stra !=.
eststo
}
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\con_char_net_zone_dif_cop_stra.csv",  r wide modelwidth(4) b(a2) starl(* 0.1 ** 0.05 *** 0.01) nogaps

**shortlisted covariates: num_child soc_07_avg hh_loc_altitude   


***specifically for those HHs that experienced shock & female

eststo clear
local con_char  age_res educat_res hh_size num_child num_adult y_edu_head max_edu_hh  num_prod_ad  land_bl pre_ce_07 a_pca_07 soc_07_avg erosion_07_avg _hh_loc_altitude hh_dist_tarma 

foreach var of local con_char {
reg `var' prog_area samp_z_1 samp_z_2 samp_z_3 samp_z_4 if cop_stra !=. & res_female==1
eststo
}
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\con_char_net_zone_dif_cop_stra_res_female.csv",  r wide modelwidth(4) b(a2) starl(* 0.1 ** 0.05 *** 0.01) nogaps

**shortlisted covariates: soc_07_avg _hh_loc_altitude   


***specifically for dairy producers

eststo clear
local con_char  age_res educat_res hh_size num_child num_adult y_edu_head max_edu_hh  num_prod_ad  land_bl pre_ce_07 a_pca_07 soc_07_avg erosion_07_avg _hh_loc_altitude hh_dist_tarma 

foreach var of local con_char {
reg `var' prog_area samp_z_1 samp_z_2 samp_z_3 samp_z_4 if dar_prod==1
eststo
}
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\con_char_net_zone_dif_dar_prod.csv",  r wide modelwidth(4) b(a2) starl(* 0.1 ** 0.05 *** 0.01) nogaps

**shortlisted covariates: hh_size num_child max_edu_hh soc_07_avg _hh_loc_altitude   


***Do it for HHs with children sec age
eststo clear
local con_char  age_res educat_res hh_size num_child num_adult y_edu_head max_edu_hh  num_prod_ad  land_bl pre_ce_07 a_pca_07 soc_07_avg erosion_07_avg _hh_loc_altitude hh_dist_tarma 

foreach var of local con_char {
reg `var' prog_area samp_z_1 samp_z_2 samp_z_3 samp_z_4 if edu_prog !=.
eststo
}
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\con_char_net_zone_dif_edu_prog.csv",  r wide modelwidth(4) b(a2) starl(* 0.1 ** 0.05 *** 0.01) nogaps

**shortlisted covariates: max_edu_hh soc_07_avg _hh_loc_altitude   


***Do it for HHs with school age children 
eststo clear
local con_char  age_res educat_res hh_size num_child num_adult y_edu_head max_edu_hh  num_prod_ad  land_bl pre_ce_07 a_pca_07 soc_07_avg erosion_07_avg _hh_loc_altitude hh_dist_tarma 

foreach var of local con_char {
reg `var' prog_area samp_z_1 samp_z_2 samp_z_3 samp_z_4 if edu_spe !=.
eststo
}
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\con_char_net_zone_dif_edu_spe.csv",  r wide modelwidth(4) b(a2) starl(* 0.1 ** 0.05 *** 0.01) nogaps

**shortlisted covariates: num_child soc_07_avg _hh_loc_altitude hh_dist_tarma   


****Do so specifically for women respondents

*compare binary respondent and household characteristics using prtest

gl bin_char "res_christ res_luhya res_married res_spo_out res_widow res_head res_spo_head res_healthy literate_res school_res official_role_res res_farmer res_busi res_employ r_tech_skill hh_farm_07 hh_lstock_07 hh_bus_07 hh_emp_07 irrig_07 head_prod elder_hh elder_headed fem_headed lit_adult f_lit_adult head_lit hh_on_road lnd_title_07 lnd_self_07_2"

**first compare all HHs in program and non-program areas
eststo clear
eststo, t("program mean"): qui mean $bin_char  if prog_area==1 & res_female==1
eststo, t("non_program mean"): qui mean $bin_char if prog_area==0 & res_female==1
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\bin_char_means_program.rtf", cells(b(f(2) l(Mean))) lab nostar mti nonum gaps  r

eststo clear
eststo, t("program vs. non-program mean"): estpost prtest $bin_char if res_female==1, by (prog_area_r) q
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\bin_char_prtests_program.rtf", r   cells(b(star fmt(a2))   z(par))  starl(* 0.1 ** 0.05 *** 0.01) mti nogaps lab


***net differences after controling for county

eststo clear
local bin_char   res_christ res_luhya res_married res_spo_out res_widow res_head res_spo_head res_healthy literate_res school_res official_role_res res_farmer res_busi res_employ r_tech_skill hh_farm_07 hh_lstock_07 hh_bus_07 hh_emp_07 irrig_07 head_prod elder_hh elder_headed fem_headed lit_adult f_lit_adult head_lit hh_on_road lnd_title_07 lnd_self_07_2

foreach var of local bin_char {
dprobit `var' prog_area county if res_female==1  
eststo
}
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\bin_char_net_coun_dif_fem.csv",  r wide modelwidth(4) b(a2) starl(* 0.1 ** 0.05 *** 0.01) nogaps


***net differences after controling for sampling zone

eststo clear
local bin_char   res_christ res_luhya res_married res_spo_out res_widow res_head res_spo_head res_healthy literate_res school_res official_role_res res_farmer res_busi res_employ r_tech_skill hh_farm_07 hh_lstock_07 hh_bus_07 hh_emp_07 irrig_07 head_prod elder_hh elder_headed fem_headed lit_adult f_lit_adult head_lit hh_on_road lnd_title_07 lnd_self_07_2

foreach var of local bin_char {
dprobit `var' prog_area samp_z_1 samp_z_2 samp_z_3 samp_z_4 if res_female==1
eststo
}
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\bin_char_net_zone_dif_female.csv",  r wide modelwidth(4) b(a2) starl(* 0.1 ** 0.05 *** 0.01) nogaps


***Compare continuous HH characteristics between program and non_programme area 
gl con_char "age_res educat_res hh_size num_child num_adult y_edu_head max_edu_hh num_prod_ad land_bl pre_ce_07 a_pca_07 soc_07_avg erosion_07_avg _hh_loc_altitude hh_dist_tarma"

eststo clear
eststo, t("program mean"):  mean $con_char  if prog_area==1 & res_female==1
eststo, t("non-program mean"):  mean $con_char  if prog_area==0 & res_female==1
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\con_char_means.rtf", cells(b(f(2) l(Mean))) lab nostar mti nonum  r gaps

***t-test 
eststo clear
eststo, t("Program vs. non-program mean"): estpost ttest $con_char if res_female==1, by (prog_area_r) q
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\con_char_tests.rtf", r   cells(b(star fmt(a2))   z(par))  starl(* 0.1 ** 0.05 *** 0.01) mti nogaps lab

***net differences after controling for site
eststo clear
local con_char  age_res educat_res hh_size num_child num_adult y_edu_head max_edu_hh  num_prod_ad  land_bl pre_ce_07 a_pca_07 soc_07_avg erosion_07_avg  _hh_loc_altitude hh_dist_tarma 

foreach var of local con_char  {
reg `var' prog_area county if res_female==1
eststo
}
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\con_char_net_coun_dif.csv",  r wide modelwidth(4) b(a2) starl(* 0.1 ** 0.05 *** 0.01) nogaps

eststo clear
local con_char  age_res educat_res hh_size num_child num_adult y_edu_head max_edu_hh  num_prod_ad  land_bl pre_ce_07 a_pca_07 soc_07_avg erosion_07_avg _hh_loc_altitude hh_dist_tarma 

foreach var of local con_char {
reg `var' prog_area samp_z_1 samp_z_2 samp_z_3 samp_z_4  if res_female==1
eststo
}
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\con_char_net_zone_dif.csv",  r wide modelwidth(4) b(a2) starl(* 0.1 ** 0.05 *** 0.01) nogaps


***Do the same for vi_group specifically against comparison areas

*compare binary respondent and household characteristics using prtest

gl bin_char "res_female res_christ res_luhya res_married res_spo_out res_widow res_head res_spo_head res_healthy literate_res school_res official_role_res res_farmer res_busi res_employ r_tech_skill hh_farm_07 hh_lstock_07 hh_bus_07 hh_emp_07 irrig_07 head_prod elder_hh elder_headed fem_headed lit_adult f_lit_adult head_lit hh_on_road lnd_title_07 lnd_self_07_2"

**first compare all HHs in program and non-program areas
eststo clear
eststo, t("vi_group mean"): qui mean $bin_char  if vi_group==1 
eststo, t("non_program area mean"): qui mean $bin_char if prog_area==0 
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\bin_char_means_vi_group.rtf", cells(b(f(2) l(Mean))) lab nostar mti nonum gaps  r

g prog_area_no_vi = (prog_area==1 & vi_group==0)

eststo clear
eststo, t("vi_group vs. non-program mean"): estpost prtest $bin_char if prog_area_no_vi==0  , by (vi_group_r) q
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\bin_char_prtests_vi_group.rtf", r   cells(b(star fmt(a2))   z(par))  starl(* 0.1 ** 0.05 *** 0.01) mti nogaps lab


***net differences after controling for county

eststo clear
local bin_char  res_female res_christ res_luhya res_married res_spo_out res_widow res_head res_spo_head res_healthy literate_res school_res official_role_res res_farmer res_busi res_employ r_tech_skill hh_farm_07 hh_lstock_07 hh_bus_07 hh_emp_07 irrig_07 head_prod elder_hh elder_headed fem_headed lit_adult f_lit_adult head_lit hh_on_road lnd_title_07 lnd_self_07_2

foreach var of local bin_char {
dprobit `var' vi_group county if prog_area_no_vi==0  
eststo
}
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\bin_char_net_coun_dif_vi_group.csv",  r wide modelwidth(4) b(a2) starl(* 0.1 ** 0.05 *** 0.01) nogaps


eststo clear
local bin_char  res_female res_christ res_luhya res_married res_spo_out res_widow res_head res_spo_head res_healthy literate_res school_res official_role_res res_farmer res_busi res_employ r_tech_skill hh_farm_07 hh_lstock_07 hh_bus_07 hh_emp_07 irrig_07 head_prod elder_hh elder_headed fem_headed lit_adult f_lit_adult head_lit hh_on_road lnd_title_07 lnd_self_07_2

foreach var of local bin_char {
dprobit `var' vi_group samp_z_1 samp_z_2 samp_z_3 samp_z_4 if prog_area_no_vi==0  
eststo
}
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\bin_char_net_zone_dif vi_group.csv",  r wide modelwidth(4) b(a2) starl(* 0.1 ** 0.05 *** 0.01) nogaps


***Compare continuous HH characteristics between vi_group and non_programme area 
gl con_char "age_res educat_res hh_size num_child num_adult y_edu_head max_edu_hh  num_prod_ad  land_bl pre_ce_07 a_pca_07 soc_07_avg erosion_07_avg _hh_loc_altitude hh_dist_tarma"

eststo clear
eststo, t("vi group"):  mean $con_char  if vi_group==1 
eststo, t("non-program mean"):  mean $con_char  if prog_area==0 
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\con_char_means_vi_group.rtf", cells(b(f(2) l(Mean))) lab nostar mti nonum  r gaps

***t-test 
eststo clear
eststo, t("Vi group vs. non-program mean"): estpost ttest $con_char if prog_area_no_vi==0, by (vi_group_r) q
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\con_char_tests_vi_group.rtf", r   cells(b(star fmt(a2))   z(par))  starl(* 0.1 ** 0.05 *** 0.01) mti nogaps lab


***net differences after controling for site
eststo clear
local con_char  age_res educat_res hh_size num_child num_adult y_edu_head max_edu_hh  num_prod_ad  land_bl pre_ce_07 a_pca_07 soc_07_avg erosion_07_avg _hh_loc_altitude hh_dist_tarma 

foreach var of local con_char {
reg `var' vi_group county if prog_area_no_vi==0
eststo
}
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\con_char_net_coun_dif_vi_group.csv",  r wide modelwidth(4) b(a2) starl(* 0.1 ** 0.05 *** 0.01) nogaps

eststo clear
local con_char  age_res educat_res hh_size num_child num_adult y_edu_head max_edu_hh  num_prod_ad  land_bl pre_ce_07 a_pca_07 soc_07_avg erosion_07_avg _hh_loc_altitude hh_dist_tarma

foreach var of local con_char {
reg `var' vi_group samp_z_1 samp_z_2 samp_z_3 samp_z_4 if prog_area_no_vi==0
eststo
}
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\con_char_net_zone_dif_vi_group.csv",  r wide modelwidth(4) b(a2) starl(* 0.1 ** 0.05 *** 0.01) nogaps


***Compare program and non-program areas in terms of the number of groups participated in and type of group focus

foreach var in  grp_type_1 grp_type_2 grp_type_3 grp_type_4 grp_type_5 grp_type_6 grp_type_7 grp_type_8 grp_type_9 grp_type_10 grp_type_11          {
			egen `var'_all = rowtotal(group_par*_`var')
		replace `var'_all = 1 if `var'_all > 0 & `var'_all !=.
		}

lab var grp_type_1_all "Crop Production 16"
lab var grp_type_2_all "Dairy 16"
lab var grp_type_3_all "Poultry 16"
lab var grp_type_4_all "Other Livestock 16"
lab var grp_type_5_all "Marketing Crops or Livestock 16"
lab var grp_type_6_all "Soil & Water Conservation 16"
lab var grp_type_7_all "Tree Planting & Mgt. 16"
lab var grp_type_8_all "Water Use 16"
lab var grp_type_9_all "Microfinance or Savings 16"
lab var grp_type_10_all "Religious Activities 16"
lab var grp_type_11_all "Other 16"		

foreach var in  grp_type_07_1 grp_type_07_2 grp_type_07_3 grp_type_07_4 grp_type_07_5 grp_type_07_6 grp_type_07_7 grp_type_07_8 grp_type_07_9 grp_type_07_10 grp_type_07_11          {
			egen `var'_all = rowtotal(group_par_07*_`var')
		replace `var'_all = 1 if `var'_all > 0 & `var'_all !=.
		}

lab var grp_type_07_1_all "Crop Production 07"
lab var grp_type_07_2_all "Dairy 07"
lab var grp_type_07_3_all "Poultry 07"
lab var grp_type_07_4_all "Other Livestock 07"
lab var grp_type_07_5_all "Marketing Crops or Livestock 07"
lab var grp_type_07_6_all "Soil & Water Conservation 07"
lab var grp_type_07_7_all "Tree Planting & Mgt. 07"
lab var grp_type_07_8_all "Water Use 07"
lab var grp_type_07_9_all "Microfinance or Savings 07"
lab var grp_type_07_10_all "Religious Activities 07"
lab var grp_type_07_11_all "Other 07"		

**create variables for participating in more than one group
g grp_part_2p = (n_grp_part >1) if n_grp_part !=.
lab var grp_part_2p ">1 group 16" 

g grp_part_2p_07 = (n_grp_part_07 >1) if n_grp_part_07 !=.
lab var grp_part_2p_07 ">1 group 07"

**Compare program and non-program HHs

gl grp_par "grp_part_2p grp_part_2p_07 grp_type_1_all grp_type_07_1_all grp_type_2_all grp_type_07_2_all grp_type_3_all grp_type_07_3_all grp_type_4_all grp_type_07_4_all grp_type_5_all grp_type_07_5_all grp_type_6_all grp_type_07_6_all grp_type_7_all grp_type_07_7_all grp_type_8_all grp_type_07_8_all grp_type_9_all grp_type_07_9_all grp_type_10_all grp_type_07_10_all grp_type_11_all grp_type_07_11_all" 

**first compare all HHs in program and non-program areas
eststo clear
eststo, t("program mean"): qui mean $grp_par  if prog_area==1 
eststo, t("non_program mean"): qui mean $grp_par if prog_area==0 
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\grp_par_means.rtf", cells(b(f(2) l(Mean))) lab nostar mti nonum gaps  r

eststo clear
eststo, t("program vs. non-program mean"): estpost prtest $grp_par, by (prog_area_r) q
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\group_par_prtests_program.rtf", r   cells(b(star fmt(a2))   z(par))  starl(* 0.1 ** 0.05 *** 0.01) mti nogaps lab


***net differences after controling for county

eststo clear
local grp_par grp_part_2p grp_part_2p_07 grp_type_1_all grp_type_07_1_all grp_type_2_all grp_type_07_2_all grp_type_3_all grp_type_07_3_all grp_type_4_all grp_type_07_4_all grp_type_5_all grp_type_07_5_all grp_type_6_all grp_type_07_6_all grp_type_7_all grp_type_07_7_all grp_type_8_all grp_type_07_8_all grp_type_9_all grp_type_07_9_all grp_type_10_all grp_type_07_10_all grp_type_11_all grp_type_07_11_all 

foreach var of local grp_par {
dprobit `var' prog_area county  
eststo
}
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\grp_par_net_coun_dif.csv",  r wide modelwidth(4) b(a2) starl(* 0.1 ** 0.05 *** 0.01) nogaps


***net differences after controling for sampling zone

eststo clear
local grp_par grp_part_2p grp_part_2p_07 grp_type_1_all grp_type_07_1_all grp_type_2_all grp_type_07_2_all grp_type_3_all grp_type_07_3_all grp_type_4_all grp_type_07_4_all grp_type_5_all grp_type_07_5_all grp_type_6_all grp_type_07_6_all grp_type_7_all grp_type_07_7_all grp_type_8_all grp_type_07_8_all grp_type_9_all grp_type_07_9_all grp_type_10_all grp_type_07_10_all grp_type_11_all grp_type_07_11_all 

foreach var of local grp_par {
dprobit `var' prog_area samp_z_1 samp_z_2 samp_z_3 samp_z_4 
eststo
}
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\grp_par_net_zone_dif.csv",  r wide modelwidth(4) b(a2) starl(* 0.1 ** 0.05 *** 0.01) nogaps


**Compare Vi_group and non-program HHs

gl grp_par "grp_part_2p grp_part_2p_07 grp_type_1_all grp_type_07_1_all grp_type_2_all grp_type_07_2_all grp_type_3_all grp_type_07_3_all grp_type_4_all grp_type_07_4_all grp_type_5_all grp_type_07_5_all grp_type_6_all grp_type_07_6_all grp_type_7_all grp_type_07_7_all grp_type_8_all grp_type_07_8_all grp_type_9_all grp_type_07_9_all grp_type_10_all grp_type_07_10_all grp_type_11_all grp_type_07_11_all" 

**first compare all HHs in program and non-program areas
eststo clear
eststo, t("Vi group mean"): qui mean $grp_par  if vi_group==1 
eststo, t("non_program mean"): qui mean $grp_par if prog_area==0 
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\grp_par_means_vi_group.rtf", cells(b(f(2) l(Mean))) lab nostar mti nonum gaps  r

eststo clear
eststo, t("Vi group vs. non-program mean"): estpost prtest $grp_par if prog_area_no_vi==0 , by (vi_group_r) q
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\group_par_prtests_vi_group.rtf", r   cells(b(star fmt(a2))   z(par))  starl(* 0.1 ** 0.05 *** 0.01) mti nogaps lab


***net differences after controling for county

eststo clear
local grp_par grp_part_2p grp_part_2p_07 grp_type_1_all grp_type_07_1_all grp_type_2_all grp_type_07_2_all grp_type_3_all grp_type_07_3_all grp_type_4_all grp_type_07_4_all grp_type_5_all grp_type_07_5_all grp_type_6_all grp_type_07_6_all grp_type_7_all grp_type_07_7_all grp_type_8_all grp_type_07_8_all grp_type_9_all grp_type_07_9_all grp_type_10_all grp_type_07_10_all grp_type_11_all grp_type_07_11_all 

foreach var of local grp_par {
dprobit `var' vi_group county if prog_area_no_vi==0  
eststo
}
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\grp_par_net_coun_dif_vi_group.csv",  r wide modelwidth(4) b(a2) starl(* 0.1 ** 0.05 *** 0.01) nogaps


***net differences after controling for sampling zone

eststo clear
local grp_par grp_part_2p grp_part_2p_07 grp_type_1_all grp_type_07_1_all grp_type_2_all grp_type_07_2_all grp_type_3_all grp_type_07_3_all grp_type_4_all grp_type_07_4_all grp_type_5_all grp_type_07_5_all grp_type_6_all grp_type_07_6_all grp_type_7_all grp_type_07_7_all grp_type_8_all grp_type_07_8_all grp_type_9_all grp_type_07_9_all grp_type_10_all grp_type_07_10_all grp_type_11_all grp_type_07_11_all 

foreach var of local grp_par {
dprobit `var' vi_group samp_z_1 samp_z_2 samp_z_3 samp_z_4 if prog_area_no_vi==0
eststo
}
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\grp_par_net_zone_dif_vi_group.csv",  r wide modelwidth(4) b(a2) starl(* 0.1 ** 0.05 *** 0.01) nogaps


****Training Exposure
g train_crop_16_sig = ((train_3yrs_1==1) & (train_crop_n>1) & ( train_crop_prac>2))
lab var train_crop_16_sig "Sig. crop training & impl. 16" 
g train_dairy_16_sig = ((train_3yrs_2==1) & (train_dairy_n>1) & ( train_dairy_prac>2))
lab var train_dairy_16_sig "Sig. dairy training & impl. 16"  
g train_slfert_16_sig = ((train_3yrs_3==1) & (train_slfert_n>1) & ( train_slfert_prac>2)) 
lab var train_slfert_16_sig "Sig. soil fertility training & impl. 16" 
g train_agrof_16_sig = ((train_3yrs_4==1) & (train_agrof_n>1) & ( train_agrof_prac>2)) 
lab var train_agrof_16_sig "Sig. agroforestry training & impl. 16" 
g train_pol_16_sig = ((train_3yrs_5==1) & (train_pol_n>1) & ( train_pol_prac>2)) 
lab var train_pol_16_sig "Sig. poltry mgt. training & impl. 16" 
g train_othliv_16_sig = ((train_3yrs_6==1) & (train_othliv_n>1) & ( train_othliv_prac>2)) 
lab var train_othliv_16_sig "Sig. other livestock training & impl. 16" 
g train_mkt_16_sig = ((train_3yrs_7==1) & (train_mkt_n>1) & ( train_mkt_prac>2))
lab var train_mkt_16_sig "Sig. marketing training & impl. 16" 
g train_proc_16_sig = ((train_3yrs_8==1) & (train_proc_n>1) & ( train_proc_prac>2))
lab var train_proc_16_sig "Sig. crop processing training & impl. 16" 
g train_mc_16_sig = ((train_3yrs_9==1) & (train_mc_n>1) & ( train_mc_prac>2))
lab var train_mc_16_sig "Sig. financial mgt. or savings training & impl. 16" 
g train_offm_16_sig = ((train_3yrs_10==1) & (train_offm_n>1) & ( train_offm_prac>2))
lab var train_offm_16_sig "Sig. off-farm business training & impl. 16" 

g train_crop_07_sig = ((train_07_1==1) & (train_crop_n_07>1) & ( train_crop_prac_07>2))
lab var train_crop_07_sig "Sig. crop training & impl. 07" 
g train_dairy_07_sig = ((train_07_2==1) & (train_dairy_n_07>1) & ( train_dairy_prac_07>2))
lab var train_dairy_07_sig "Sig. dairy training & impl. 07"  
g train_slfert_07_sig = ((train_07_3==1) & (train_slfert_n_07>1) & ( train_slfert_prac_07>2)) 
lab var train_slfert_07_sig "Sig. soil fertility training & impl. 07" 
g train_agrof_07_sig = ((train_07_4==1) & (train_agrof_n_07>1) & ( train_agrof_prac_07>2)) 
lab var train_agrof_07_sig "Sig. agroforestry training & impl. 07" 
g train_pol_07_sig = ((train_07_5==1) & (train_pol_n_07>1) & ( train_pol_prac_07>2)) 
lab var train_pol_07_sig "Sig. poltry mgt. training & impl. 07" 
g train_othliv_07_sig = ((train_07_6==1) & (train_othliv_n_07>1) & ( train_othliv_prac_07>2)) 
lab var train_othliv_07_sig "Sig. other livestock training & impl. 07" 
g train_mkt_07_sig = ((train_07_7==1) & (train_mkt_n_07>1) & ( train_mkt_prac_07>2))
lab var train_mkt_07_sig "Sig. marketing training & impl. 07" 
g train_proc_07_sig = ((train_07_8==1) & (train_proc_n_07>1) & ( train_proc_prac_07>2))
lab var train_proc_07_sig "Sig. crop processing training & impl. 07" 
g train_mc_07_sig = ((train_07_9==1) & (train_mc_n_07>1) & ( train_mc_prac_07>2))
lab var train_mc_07_sig "Sig. financial mgt. or savings training & impl. 07" 
g train_offm_07_sig = ((train_07_10==1) & (train_offm_n_07>1) & ( train_offm_prac_07>2))
lab var train_offm_07_sig "Sig. off-farm business training & impl. 07" 


egen train_sig_16_any = rowtotal(train_crop_16_sig train_dairy_16_sig train_slfert_16_sig train_agrof_16_sig train_pol_16_sig train_othliv_16_sig train_mkt_16_sig train_proc_16_sig train_mc_16_sig train_offm_16_sig )

g train_sig_16_any_1p = (train_sig_16_any>0)
lab var train_sig_16_any_1p "Significant training in at least 1 area 16"
g train_sig_16_any_2p = (train_sig_16_any>1) 
lab var train_sig_16_any_2p "Significant training in at least 2 areas 16"

egen train_sig_07_any = rowtotal(train_crop_07_sig train_dairy_07_sig train_slfert_07_sig train_agrof_07_sig train_pol_07_sig train_othliv_07_sig train_mkt_07_sig train_proc_07_sig train_mc_07_sig train_offm_07_sig )

g train_sig_07_any_1p = (train_sig_07_any>0)
lab var train_sig_07_any_1p "Significant training in at least 1 area 07"
g train_sig_07_any_2p = (train_sig_07_any>1) 
lab var train_sig_07_any_2p "Significant training in at least 2 areas 07"


**first compare all HHs in program and non-program areas

gl sig_train "train_sig_16_any_1p train_sig_07_any_1p train_sig_16_any_2p train_sig_07_any_2p train_crop_16_sig train_crop_07_sig train_dairy_16_sig train_dairy_07_sig train_slfert_16_sig train_slfert_07_sig train_agrof_16_sig train_agrof_07_sig train_pol_16_sig train_pol_07_sig train_othliv_16_sig train_othliv_07_sig train_mkt_16_sig train_mkt_07_sig train_proc_16_sig train_proc_07_sig train_mc_16_sig train_mc_07_sig train_offm_16_sig train_offm_07_sig"

eststo clear
eststo, t("program mean"): qui mean $sig_train  if prog_area==1 
eststo, t("non_program mean"): qui mean $sig_train if prog_area==0 
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\sig_train_means.rtf", cells(b(f(2) l(Mean))) lab nostar mti nonum gaps  r

eststo clear
eststo, t("program vs. non-program mean"): estpost prtest $sig_train, by (prog_area_r) q
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\sig_train_prtests_program.rtf", r   cells(b(star fmt(a2))   z(par))  starl(* 0.1 ** 0.05 *** 0.01) mti nogaps lab


***net differences after controling for county

eststo clear
local sig_train train_sig_16_any_1p train_sig_07_any_1p train_sig_16_any_2p train_sig_07_any_2p train_crop_16_sig train_crop_07_sig train_dairy_16_sig train_dairy_07_sig train_slfert_16_sig train_slfert_07_sig train_agrof_16_sig train_agrof_07_sig train_pol_16_sig train_pol_07_sig train_othliv_16_sig train_othliv_07_sig train_mkt_16_sig train_mkt_07_sig train_proc_16_sig train_proc_07_sig train_mc_16_sig train_mc_07_sig train_offm_16_sig train_offm_07_sig

foreach var of local sig_train {
probit `var' prog_area county  
eststo
}
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\grp_par_net_coun_dif_sig_train.csv",  r wide modelwidth(4) b(a2) starl(* 0.1 ** 0.05 *** 0.01) nogaps


***net differences after controling for sampling zone

eststo clear
local sig_train train_sig_16_any_1p train_sig_07_any_1p train_sig_16_any_2p train_sig_07_any_2p train_crop_16_sig train_crop_07_sig train_dairy_16_sig train_dairy_07_sig train_slfert_16_sig train_slfert_07_sig train_agrof_16_sig train_agrof_07_sig train_pol_16_sig train_pol_07_sig train_othliv_16_sig train_othliv_07_sig train_mkt_16_sig train_mkt_07_sig train_proc_16_sig train_proc_07_sig train_mc_16_sig train_mc_07_sig train_offm_16_sig train_offm_07_sig

foreach var of local sig_train {
dprobit `var' prog_area samp_z_1 samp_z_2 samp_z_3 samp_z_4 
eststo
}
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\sig_train_net_zone_dif.csv",  r wide modelwidth(4) b(a2) starl(* 0.1 ** 0.05 *** 0.01) nogaps


**second compare all HHs in vi groups and non-program areas

gl sig_train "train_sig_16_any_1p train_sig_07_any_1p train_sig_16_any_2p train_sig_07_any_2p train_crop_16_sig train_crop_07_sig train_dairy_16_sig train_dairy_07_sig train_slfert_16_sig train_slfert_07_sig train_agrof_16_sig train_agrof_07_sig train_pol_16_sig train_pol_07_sig train_othliv_16_sig train_othliv_07_sig train_mkt_16_sig train_mkt_07_sig train_proc_16_sig train_proc_07_sig train_mc_16_sig train_mc_07_sig train_offm_16_sig train_offm_07_sig"

eststo clear
eststo, t("Vi group mean"): qui mean $sig_train  if vi_group==1 
eststo, t("non_program mean"): qui mean $sig_train if prog_area==0 
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\sig_train_means.rtf", cells(b(f(2) l(Mean))) lab nostar mti nonum gaps  r

eststo clear
eststo, t("Vi group vs. non-program mean"): estpost prtest $sig_train if prog_area_no_vi==0, by (vi_group_r) q
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\sig_train_prtests_vi_group.rtf", r   cells(b(star fmt(a2))   z(par))  starl(* 0.1 ** 0.05 *** 0.01) mti nogaps lab


***net differences after controling for county

eststo clear
local sig_train train_sig_16_any_1p train_sig_07_any_1p train_sig_16_any_2p train_sig_07_any_2p train_crop_16_sig train_crop_07_sig train_dairy_16_sig train_dairy_07_sig train_slfert_16_sig train_slfert_07_sig train_agrof_16_sig train_agrof_07_sig train_pol_16_sig train_pol_07_sig train_othliv_16_sig train_othliv_07_sig train_mkt_16_sig train_mkt_07_sig train_proc_16_sig train_proc_07_sig train_mc_16_sig train_mc_07_sig train_offm_16_sig train_offm_07_sig

foreach var of local sig_train {
probit `var' vi_group county if prog_area_no_vi==0 
eststo
}
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\net_coun_dif_sig_train_vi_group.csv",  r wide modelwidth(4) b(a2) starl(* 0.1 ** 0.05 *** 0.01) nogaps


***net differences after controling for sampling zone

eststo clear
local sig_train train_sig_16_any_1p train_sig_07_any_1p train_sig_16_any_2p train_sig_07_any_2p train_crop_16_sig train_crop_07_sig train_dairy_16_sig train_dairy_07_sig train_slfert_16_sig train_slfert_07_sig train_agrof_16_sig train_agrof_07_sig train_pol_16_sig train_pol_07_sig train_othliv_16_sig train_othliv_07_sig train_mkt_16_sig train_mkt_07_sig train_proc_16_sig train_proc_07_sig train_mc_16_sig train_mc_07_sig train_offm_16_sig train_offm_07_sig

foreach var of local sig_train {
dprobit `var' vi_group samp_z_1 samp_z_2 samp_z_3 samp_z_4 if prog_area_no_vi==0
eststo
}
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\sig_train_net_zone_dif_vi.csv",  r wide modelwidth(4) b(a2) starl(* 0.1 ** 0.05 *** 0.01) nogaps


**=========================================================================
******Compare groups in relation to AF index and its respective indicators
**=========================================================================

***Start with Individual Indicators 

local ind_AF mn_par_pro tree_nrm com_prac tree_dens_alt tr_pro_sale comp_prac_int comp_prac_sale legume_shrub long_spe_exo long_spe_nat

foreach var of local ind_AF  {
g `var'_dif =  (`var'_16 - `var'_07)
}

gl ind_AF "mn_par_pro_07 mn_par_pro_16 mn_par_pro_dif tree_nrm_07 tree_nrm_16 tree_nrm_dif com_prac_07 com_prac_16 com_prac_dif tree_dens_alt_07 tree_dens_alt_16 tree_dens_alt_dif tr_pro_sale_07 tr_pro_sale_16 tr_pro_sale_dif comp_prac_int_07 comp_prac_int_16 comp_prac_int_dif comp_prac_sale_07 comp_prac_sale_16 comp_prac_sale_dif legume_shrub_07 legume_shrub_16 legume_shrub_dif long_spe_exo_07 long_spe_exo_16 long_spe_exo_dif long_spe_nat_07 long_spe_nat_16 long_spe_nat_dif" 

**first compare all HHs in program and non-program areas
eststo clear
eststo, t("Overall Program Area"): qui mean $ind_AF  if prog_area==1 
eststo, t("Vi Group"): qui mean $ind_AF  if vi_group==1
eststo, t("Non-Vi in Prog. Area"): qui mean $ind_AF  if prog_area==1  & vi_group==0 
eststo, t("Non-Program Area"): qui mean $ind_AF if prog_area==0 
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\ind_AF_means.rtf", cells(b(f(2) l(Mean))) lab nostar mti nonum gaps  r


**Program vs. non-program area
eststo clear
local ind_AF mn_par_pro_07 mn_par_pro_16 mn_par_pro_dif tree_nrm_07 tree_nrm_16 tree_nrm_dif com_prac_07 com_prac_16 com_prac_dif tree_dens_alt_07 tree_dens_alt_16 tree_dens_alt_dif tr_pro_sale_07 tr_pro_sale_16 tr_pro_sale_dif comp_prac_int_07 comp_prac_int_16 comp_prac_int_dif comp_prac_sale_07 comp_prac_sale_16 comp_prac_sale_dif legume_shrub_07 legume_shrub_16 legume_shrub_dif long_spe_exo_07 long_spe_exo_16 long_spe_exo_dif long_spe_nat_07 long_spe_nat_16 long_spe_nat_dif 

foreach var of local ind_AF {
reg `var' prog_area
eststo
}

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\ind_AF_t-tests_program.csv",  r wide modelwidth(4) b(a2) starl(* 0.1 ** 0.05 *** 0.01) nogaps


eststo clear
local ind_AF mn_par_pro_07 mn_par_pro_16 mn_par_pro_dif tree_nrm_07 tree_nrm_16 tree_nrm_dif com_prac_07 com_prac_16 com_prac_dif tree_dens_alt_07 tree_dens_alt_16 tree_dens_alt_dif tr_pro_sale_07 tr_pro_sale_16 tr_pro_sale_dif comp_prac_int_07 comp_prac_int_16 comp_prac_int_dif comp_prac_sale_07 comp_prac_sale_16 comp_prac_sale_dif legume_shrub_07 legume_shrub_16 legume_shrub_dif long_spe_exo_07 long_spe_exo_16 long_spe_exo_dif long_spe_nat_07 long_spe_nat_16 long_spe_nat_dif 

foreach var of local ind_AF {
reg `var' vi_group if prog_area_no_vi==0  
eststo
}

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\ind_AF_t-tests_vi_group.csv",  r wide modelwidth(4) b(a2) starl(* 0.1 ** 0.05 *** 0.01) nogaps


eststo clear
local ind_AF mn_par_pro_07 mn_par_pro_16 mn_par_pro_dif tree_nrm_07 tree_nrm_16 tree_nrm_dif com_prac_07 com_prac_16 com_prac_dif tree_dens_alt_07 tree_dens_alt_16 tree_dens_alt_dif tr_pro_sale_07 tr_pro_sale_16 tr_pro_sale_dif comp_prac_int_07 comp_prac_int_16 comp_prac_int_dif comp_prac_sale_07 comp_prac_sale_16 comp_prac_sale_dif legume_shrub_07 legume_shrub_16 legume_shrub_dif long_spe_exo_07 long_spe_exo_16 long_spe_exo_dif long_spe_nat_07 long_spe_nat_16 long_spe_nat_dif 

foreach var of local ind_AF {
reg `var' vi_group if prog_area==1  
eststo
}

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\ind_AF_t-tests_vi_group_in_PA.csv",  r wide modelwidth(4) b(a2) starl(* 0.1 ** 0.05 *** 0.01) nogaps


***compare groups in terms of the overall index and its dimensions

gl AF_ind_com "af_ind_07 af_ind_16 af_ind_dif af_ind_d1_07_uw af_ind_d1_16_uw af_ind_d1_dif af_ind_d2_07_uw af_ind_d2_16_uw af_ind_d2_dif af_ind_d3_07_uw af_ind_d3_16_uw af_ind_d3_dif" 

**first compare all HHs in program and non-program areas
eststo clear
eststo, t("Overall Program Area"): qui mean $AF_ind_com  if prog_area==1 
eststo, t("Vi Group"): qui mean $AF_ind_com  if vi_group==1
eststo, t("Non-Vi in Prog. Area"): qui mean $AF_ind_com  if prog_area==1  & vi_group==0 
eststo, t("Non-Program Area"): qui mean $AF_ind_com if prog_area==0 
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\AF_ind_com_means.rtf", cells(b(f(2) l(Mean))) lab nostar mti nonum gaps  r


**Program vs. non-program area
eststo clear
local AF_ind af_ind_07 af_ind_16 af_ind_dif af_ind_d1_07_uw af_ind_d1_16_uw af_ind_d1_dif af_ind_d2_07_uw af_ind_d2_16_uw af_ind_d2_dif af_ind_d3_07_uw af_ind_d3_16_uw af_ind_d3_dif 

foreach var of local AF_ind {
reg `var' prog_area
eststo
}

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\AF_ind_com_t-tests_program.csv",  r wide modelwidth(4) b(a2) starl(* 0.1 ** 0.05 *** 0.01) nogaps

**Vi group vs. non-program area

eststo clear
local AF_ind af_ind_07 af_ind_16 af_ind_dif af_ind_d1_07_uw af_ind_d1_16_uw af_ind_d1_dif af_ind_d2_07_uw af_ind_d2_16_uw af_ind_d2_dif af_ind_d3_07_uw af_ind_d3_16_uw af_ind_d3_dif

foreach var of local AF_ind {
reg `var' vi_group if prog_area_no_vi==0  
eststo
}

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\AF_ind_com_t-tests_vi_group.csv",  r wide modelwidth(4) b(a2) starl(* 0.1 ** 0.05 *** 0.01) nogaps

eststo clear
local AF_ind af_ind_07 af_ind_16 af_ind_dif af_ind_d1_07_uw af_ind_d1_16_uw af_ind_d1_dif af_ind_d2_07_uw af_ind_d2_16_uw af_ind_d2_dif af_ind_d3_07_uw af_ind_d3_16_uw af_ind_d3_dif

foreach var of local AF_ind {
reg `var' vi_group if prog_area==1  
eststo
}

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\AF_ind_com_t-tests_vi_group_PA.csv",  r wide modelwidth(4) b(a2) starl(* 0.1 ** 0.05 *** 0.01) nogaps



***create output of differences with standard errors

eststo clear

reg af_ind_dif prog_area , r
eststo
reg af_ind_d1_dif prog_area , r
eststo
reg af_ind_d2_dif prog_area , r
eststo
reg af_ind_d3_dif prog_area, r
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\af_ind_raw.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)




***Differential effects -- Sampling Zone

**gen treat dummy for each samping zone
g samp_z_1_pa = (samp_z_1==1 & prog_area==1)
g samp_z_2_pa = (samp_z_2==1 & prog_area==1)
g samp_z_3_pa = (samp_z_3==1 & prog_area==1)
g samp_z_4_pa = (samp_z_4==1 & prog_area==1)

**examine zone specific differences

eststo clear

reg af_ind_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa i.zone , r
eststo
reg af_ind_d1_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa i.zone , r
eststo
reg af_ind_d2_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa i.zone , r
eststo
reg af_ind_d3_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa i.zone , r
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\af_ind_vsz_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

***implement Wald test to assess how different coefficients are

**overall index

eststo clear

reg af_ind_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa i.zone , r
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg af_ind_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa i.zone , r
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg af_ind_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa i.zone , r
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg af_ind_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa i.zone , r
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg af_ind_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa i.zone , r
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg af_ind_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa i.zone , r
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 

**D1
eststo clear

reg af_ind_d1_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa i.zone , r
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg af_ind_d1_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa i.zone , r
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg af_ind_d1_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa i.zone, r
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg af_ind_d1_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa i.zone , r
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg af_ind_d1_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa i.zone , r
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg af_ind_d1_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa i.zone , r
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 

*D2

eststo clear

reg af_ind_d2_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa i.zone , r
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg af_ind_d2_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa i.zone , r
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg af_ind_d2_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa i.zone, r
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg af_ind_d2_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa i.zone , r
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg af_ind_d2_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa i.zone , r
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg af_ind_d2_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa i.zone, r
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 


*D3

eststo clear

reg af_ind_d3_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa i.zone , r
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg af_ind_d3_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa i.zone , r
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg af_ind_d3_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa i.zone , r
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg af_ind_d3_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa i.zone , r
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg af_ind_d3_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa i.zone , r
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg af_ind_d3_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa i.zone , r
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 


***Differential effects -- Gender

**gen treatment dummies for female and male
g prog_area_f = (res_female==1 & prog_area==1)
g prog_area_m = (res_female==0 & prog_area==1)


**examine gender specific differences

eststo clear

reg af_ind_dif prog_area_f prog_area_m res_female , r
eststo
reg af_ind_d1_dif prog_area_f prog_area_m res_female , r
eststo
reg af_ind_d2_dif prog_area_f prog_area_m res_female , r
eststo
reg af_ind_d3_dif prog_area_f prog_area_m res_female, r
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\af_ind_gen_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests for gender

eststo clear

reg af_ind_dif prog_area_f prog_area_m res_female , r
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg af_ind_d1_dif prog_area_f prog_area_m res_female, r
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg af_ind_d2_dif prog_area_f prog_area_m res_female, r
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg af_ind_d3_dif prog_area_f prog_area_m res_female, r
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

estout a b c d,  stats(test test_prob) 



***Differential effects -- Sex of HH Head

**gen treatment dummies for female and male
g prog_area_f_h = (fem_headed==1 & prog_area==1)
g prog_area_m_h = (fem_headed==0 & prog_area==1)


**examine c differences

eststo clear

reg af_ind_dif prog_area_f_h prog_area_m_h fem_headed, r
eststo
reg af_ind_d1_dif prog_area_f_h prog_area_m_h fem_headed, r
eststo
reg af_ind_d2_dif prog_area_f_h prog_area_m_h fem_headed, r
eststo
reg af_ind_d3_dif prog_area_f_h prog_area_m_h fem_headed, r
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\af_ind_sex_head_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests for sex of head

eststo clear

reg af_ind_dif prog_area_f_h prog_area_m_h fem_headed, r
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg af_ind_d1_dif prog_area_f_h prog_area_m_h fem_headed, r
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg af_ind_d2_dif prog_area_f_h prog_area_m_h fem_headed, r
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg af_ind_d3_dif prog_area_f_h prog_area_m_h fem_headed, r
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

estout a b c d,  stats(test test_prob) 


***Differential effects -- Education of respondent

**gen treatment dummies
g prog_area_8p_edu = (educat_res>7 & prog_area==1)
g prog_area_8u_edu = (educat_res<8 & prog_area==1)

g res_over_7_edu = (educat_res>7)

**examine  differences

eststo clear

reg af_ind_dif prog_area_8p_edu prog_area_8u_edu res_over_7_edu , r
eststo
reg af_ind_d1_dif prog_area_8p_edu prog_area_8u_edu res_over_7_edu , r
eststo
reg af_ind_d2_dif prog_area_8p_edu prog_area_8u_edu res_over_7_edu , r
eststo
reg af_ind_d3_dif prog_area_8p_edu prog_area_8u_edu res_over_7_edu , r
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\af_ind_edu_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests for education

eststo clear

reg af_ind_dif prog_area_8p_edu prog_area_8u_edu res_over_7_edu , r
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg af_ind_d1_dif prog_area_8p_edu prog_area_8u_edu res_over_7_edu , r
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg af_ind_d2_dif prog_area_8p_edu prog_area_8u_edu res_over_7_edu , r
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg af_ind_d3_dif prog_area_8p_edu prog_area_8u_edu res_over_7_edu , r
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

estout a b c d,  stats(test test_prob) 



***Differential effects -- Baseline Wealth

**gen treatment dummies 

xtile a_pca_07_by_z_bin =  a_pca_07_by_z , n(2)

g prog_area_asset_poor = (a_pca_07_by_z_bin==1 & prog_area==1)
g prog_area_asset_rich = (a_pca_07_by_z_bin==2 & prog_area==1)

g bl_asset_rich = (a_pca_07_by_z_bin==2)
g bl_asset_poor = (a_pca_07_by_z_bin==1)

**examine sub-group specific differences

eststo clear

reg af_ind_dif prog_area_asset_poor prog_area_asset_rich  bl_asset_poor , r
eststo
reg af_ind_d1_dif prog_area_asset_poor prog_area_asset_rich  bl_asset_poor , r
eststo
reg af_ind_d2_dif prog_area_asset_poor prog_area_asset_rich  bl_asset_poor , r
eststo
reg af_ind_d3_dif prog_area_asset_poor prog_area_asset_rich  bl_asset_poor , r
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\af_ind_asset_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests for education

eststo clear

reg af_ind_dif prog_area_asset_rich prog_area_asset_poor bl_asset_rich , r
test prog_area_asset_rich = prog_area_asset_poor
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg af_ind_d1_dif prog_area_asset_rich prog_area_asset_poor bl_asset_rich , r
test prog_area_asset_rich = prog_area_asset_poor
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg af_ind_d2_dif prog_area_asset_rich prog_area_asset_poor bl_asset_rich , r
test prog_area_asset_rich = prog_area_asset_poor
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg af_ind_d3_dif prog_area_asset_rich prog_area_asset_poor bl_asset_rich , r
test prog_area_asset_rich = prog_area_asset_poor
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

estout a b c d,  stats(test test_prob) 


***Differential effects -- Land Holding Size

**gen treatment dummies

g prog_area_land_u2 = (land_bl<2 & prog_area==1)
g prog_area_land_o2 = (land_b>=2 & prog_area==1)

g land_o2 = (land_b>=2)

**examine sub-group specific differences

eststo clear

reg af_ind_dif prog_area_land_u2 prog_area_land_o2 land_o2 , r
eststo
reg af_ind_d1_dif prog_area_land_u2 prog_area_land_o2 land_o2, r
eststo
reg af_ind_d2_dif prog_area_land_u2 prog_area_land_o2 land_o2 , r
eststo
reg af_ind_d3_dif prog_area_land_u2 prog_area_land_o2 land_o2 , r
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\af_ind_asset_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

eststo clear

reg af_ind_dif prog_area_land_u2 prog_area_land_o2 land_o2 , r
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg af_ind_d1_dif prog_area_land_u2 prog_area_land_o2 land_o2 , r
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg af_ind_d2_dif prog_area_land_u2 prog_area_land_o2 land_o2 , r
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg af_ind_d3_dif prog_area_land_u2 prog_area_land_o2 land_o2 , r
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

estout a b c d,  stats(test test_prob) 



***Differential effects -- Dairy Farmers

**gen treatment dummies

g prog_area_dar = (dar_prod==1 & prog_area==1)
g prog_area_no_dar = (dar_prod==0 & prog_area==1)

**examine sub-group specific differences

eststo clear

reg af_ind_dif prog_area_dar prog_area_no_dar dar_prod , r
eststo
reg af_ind_d1_dif prog_area_dar prog_area_no_dar dar_prod , r
eststo
reg af_ind_d2_dif prog_area_dar prog_area_no_dar dar_prod , r
eststo
reg af_ind_d3_dif prog_area_dar prog_area_no_dar dar_prod , r
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\af_ind_dar_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

eststo clear

reg af_ind_dif prog_area_dar prog_area_no_dar dar_prod, r
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg af_ind_d1_dif prog_area_dar prog_area_no_dar dar_prod , r
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg af_ind_d2_dif prog_area_dar prog_area_no_dar dar_prod , r
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg af_ind_d3_dif prog_area_dar prog_area_no_dar dar_prod , r
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

estout a b c d,  stats(test test_prob) 



***Differential effects -- Official Position

**gen treatment dummies

g prog_area_OP = (official_role_res==1 & prog_area==1)
g prog_area_no_OP = (official_role_res==0 & prog_area==1)

**examine sub-group specific differences

eststo clear

reg af_ind_dif prog_area_OP prog_area_no_OP official_role_res, r
eststo
reg af_ind_d1_dif prog_area_OP prog_area_no_OP official_role_res, r
eststo
reg af_ind_d2_dif prog_area_OP prog_area_no_OP official_role_res, r
eststo
reg af_ind_d3_dif prog_area_OP prog_area_no_OP official_role_res, r
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\af_ind_OP_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

eststo clear

reg af_ind_dif prog_area_OP prog_area_no_OP official_role_res, r
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg af_ind_d1_dif prog_area_OP prog_area_no_OP official_role_res, r
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg af_ind_d2_dif prog_area_OP prog_area_no_OP official_role_res, r
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg af_ind_d3_dif prog_area_OP prog_area_no_OP official_role_res, r
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

estout a b c d,  stats(test test_prob) 




***Differential effects -- land ownership (not with spouse; formal or unformal title)

**gen treatment dummies

g prog_area_lnd_self = (lnd_self_07_2==1 & prog_area==1)
g prog_area_lnd_oth= (lnd_self_07_2==0 & prog_area==1)

g lnd_self = lnd_self_07_2
**examine sub-group specific differences

eststo clear

reg af_ind_dif prog_area_lnd_self prog_area_lnd_oth lnd_self    i.zone  , cluster(groupid)
eststo

reg af_ind_d1_dif prog_area_lnd_self prog_area_lnd_oth lnd_self   i.zone  , cluster(groupid)
eststo

reg af_ind_d2_dif prog_area_lnd_self prog_area_lnd_oth lnd_self    i.zone  , cluster(groupid)
eststo

reg af_ind_d3_dif prog_area_lnd_self prog_area_lnd_oth lnd_self   i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\af_ind_land_own_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 


eststo clear

reg af_ind_dif prog_area_lnd_self prog_area_lnd_oth lnd_self  , cluster(groupid)
test prog_area_lnd_self = prog_area_lnd_oth
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg af_ind_d1_dif prog_area_lnd_self prog_area_lnd_oth lnd_self  , cluster(groupid)
test prog_area_lnd_self = prog_area_lnd_oth
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg af_ind_d2_dif prog_area_lnd_self prog_area_lnd_oth lnd_self  , cluster(groupid)
test prog_area_lnd_self = prog_area_lnd_oth
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg af_ind_d3_dif prog_area_lnd_self prog_area_lnd_oth lnd_self  , cluster(groupid)
test prog_area_lnd_self = prog_area_lnd_oth
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

estout a b c d,  stats(test test_prob) 



***Differential effects -- land ownership (formal or unformal title with or without spouse)

**gen treatment dummies

g prog_area_lnd_hh = (lnd_self_07==1 & prog_area==1)
g prog_area_lnd_n_hh= (lnd_self_07==0 & prog_area==1)


**examine sub-group specific differences

eststo clear

reg af_ind_dif prog_area_lnd_hh prog_area_lnd_n_hh lnd_self_07  i.zone  , cluster(groupid)
eststo

reg af_ind_d1_dif prog_area_lnd_hh prog_area_lnd_n_hh lnd_self_07  i.zone  , cluster(groupid)
eststo

reg af_ind_d2_dif prog_area_lnd_hh prog_area_lnd_n_hh lnd_self_07  i.zone  , cluster(groupid)
eststo

reg af_ind_d3_dif prog_area_lnd_hh prog_area_lnd_n_hh lnd_self_07  i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\af_ind_land_own_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 


eststo clear

reg af_ind_dif prog_area_lnd_hh prog_area_lnd_n_hh lnd_self_07  i.zone  , cluster(groupid)
test prog_area_lnd_hh = prog_area_lnd_n_hh
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg af_ind_d1_dif prog_area_lnd_hh prog_area_lnd_n_hh lnd_self_07  i.zone  , cluster(groupid)
test prog_area_lnd_hh = prog_area_lnd_n_hh
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg af_ind_d2_dif prog_area_lnd_hh prog_area_lnd_n_hh lnd_self_07  i.zone  , cluster(groupid)
test prog_area_lnd_hh = prog_area_lnd_n_hh
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg af_ind_d3_dif prog_area_lnd_hh prog_area_lnd_n_hh lnd_self_07  i.zone  , cluster(groupid)
test prog_area_lnd_hh = prog_area_lnd_n_hh
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

estout a b c d,  stats(test test_prob) 



***Differential effects -- land ownership formal title

**gen treatment dummies

g prog_area_lnd_tl = (lnd_title_07==1 & prog_area==1)
g prog_area_no_ln_tl= (lnd_title_07==0 & prog_area==1)


**examine sub-group specific differences

eststo clear

reg af_ind_dif prog_area_lnd_tl prog_area_no_ln_tl lnd_self  i.zone  , cluster(groupid)
eststo

reg af_ind_d1_dif prog_area_lnd_tl prog_area_no_ln_tl lnd_self  i.zone  , cluster(groupid)
eststo

reg af_ind_d2_dif prog_area_lnd_tl prog_area_no_ln_tl lnd_self  i.zone  , cluster(groupid)
eststo

reg af_ind_d3_dif prog_area_lnd_tl prog_area_no_ln_tl lnd_self  i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\af_ind_land_title_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 


eststo clear

reg af_ind_dif prog_area_lnd_tl prog_area_no_ln_tl  i.zone  , cluster(groupid)
test prog_area_lnd_tl = prog_area_no_ln_tl
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg af_ind_d1_dif prog_area_lnd_tl prog_area_no_ln_tl  i.zone  , cluster(groupid)
test prog_area_lnd_tl = prog_area_no_ln_tl
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg af_ind_d2_dif prog_area_lnd_tl prog_area_no_ln_tl  i.zone  , cluster(groupid)
test prog_area_lnd_tl = prog_area_no_ln_tl
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg af_ind_d3_dif prog_area_lnd_tl prog_area_no_ln_tl  i.zone  , cluster(groupid)
test prog_area_lnd_tl = prog_area_no_ln_tl
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

estout a b c d ,  stats(test test_prob) 




***Create AFI averages for Graphs
**By dimension
tabstat af_ind_d1_07 af_ind_d2_07 af_ind_d3_07 if prog_area ==1
tabstat af_ind_d1_16 af_ind_d2_16 af_ind_d3_16 if prog_area ==1
tabstat af_ind_d1_dif_w af_ind_d2_dif_w af_ind_d3_dif_w if prog_area==1
tabstat af_ind_d1_07 af_ind_d2_07 af_ind_d3_07 if vi_group ==1
tabstat af_ind_d1_16 af_ind_d2_16 af_ind_d3_16 if vi_group ==1
tabstat af_ind_d1_dif_w af_ind_d2_dif_w af_ind_d3_dif_w if vi_group==1
tabstat af_ind_d1_07 af_ind_d2_07 af_ind_d3_07 if prog_area ==0
tabstat af_ind_d1_16 af_ind_d2_16 af_ind_d3_16 if prog_area ==0
tabstat af_ind_d1_dif_w af_ind_d2_dif_w af_ind_d3_dif_w if prog_area==0

**By gender (differences only)
tabstat af_ind_d1_dif_w af_ind_d2_dif_w af_ind_d3_dif_w if prog_area==1 & res_female==1
tabstat af_ind_d1_dif_w af_ind_d2_dif_w af_ind_d3_dif_w if prog_area==1 & res_female==0
tabstat af_ind_d1_dif_w af_ind_d2_dif_w af_ind_d3_dif_w if vi_group==1 & res_female==1
tabstat af_ind_d1_dif_w af_ind_d2_dif_w af_ind_d3_dif_w if vi_group==1 & res_female==0
tabstat af_ind_d1_dif_w af_ind_d2_dif_w af_ind_d3_dif_w if prog_area==0 & res_female==1
tabstat af_ind_d1_dif_w af_ind_d2_dif_w af_ind_d3_dif_w if prog_area==0 & res_female==0

**By zone (differences only)
tabstat af_ind_d1_dif_w af_ind_d2_dif_w af_ind_d3_dif_w if prog_area==1 & zone==1
tabstat af_ind_d1_dif_w af_ind_d2_dif_w af_ind_d3_dif_w if prog_area==1 & zone==2
tabstat af_ind_d1_dif_w af_ind_d2_dif_w af_ind_d3_dif_w if prog_area==1 & zone==3
tabstat af_ind_d1_dif_w af_ind_d2_dif_w af_ind_d3_dif_w if prog_area==1 & zone==4
tabstat af_ind_d1_dif_w af_ind_d2_dif_w af_ind_d3_dif_w if prog_area==0 & zone==1
tabstat af_ind_d1_dif_w af_ind_d2_dif_w af_ind_d3_dif_w if prog_area==0 & zone==2
tabstat af_ind_d1_dif_w af_ind_d2_dif_w af_ind_d3_dif_w if prog_area==0 & zone==3
tabstat af_ind_d1_dif_w af_ind_d2_dif_w af_ind_d3_dif_w if prog_area==0 & zone==4

**by each weighted indicator
tabstat mn_par_pro_07_ind tree_nrm_07_ind com_prac_07_ind tree_dens_alt_07_ind tr_pro_sale_07_ind comp_prac_int_07_ind comp_prac_sale_07_ind legume_shrub_07_ind long_spe_exo_07_ind long_spe_nat_07_ind if prog_area==1
tabstat mn_par_pro_16_ind tree_nrm_16_ind com_prac_16_ind tree_dens_alt_16_ind tr_pro_sale_16_ind comp_prac_int_16_ind comp_prac_sale_16_ind legume_shrub_16_ind long_spe_exo_16_ind long_spe_nat_16_ind  if prog_area==1
tabstat mn_par_pro_07_ind tree_nrm_07_ind com_prac_07_ind tree_dens_alt_07_ind tr_pro_sale_07_ind comp_prac_int_07_ind comp_prac_sale_07_ind legume_shrub_07_ind long_spe_exo_07_ind long_spe_nat_07_ind  if vi_group==1
tabstat mn_par_pro_16_ind tree_nrm_16_ind com_prac_16_ind tree_dens_alt_16_ind tr_pro_sale_16_ind comp_prac_int_16_ind comp_prac_sale_16_ind legume_shrub_16_ind long_spe_exo_16_ind long_spe_nat_16_ind  if vi_group==1
tabstat mn_par_pro_07_ind tree_nrm_07_ind com_prac_07_ind tree_dens_alt_07_ind tr_pro_sale_07_ind comp_prac_int_07_ind comp_prac_sale_07_ind legume_shrub_07_ind long_spe_exo_07_ind long_spe_nat_07_ind if prog_area==0
tabstat mn_par_pro_16_ind tree_nrm_16_ind com_prac_16_ind tree_dens_alt_16_ind tr_pro_sale_16_ind comp_prac_int_16_ind comp_prac_sale_16_ind legume_shrub_16_ind long_spe_exo_16_ind long_spe_nat_16_ind  if prog_area==0


***gen specific AF index for zones for box plots

g af_ind_dif_z1 = af_ind_dif if zone==1
g af_ind_dif_z2 = af_ind_dif if zone==2
g af_ind_dif_z3 = af_ind_dif if zone==3
g af_ind_dif_z4 = af_ind_dif if zone==4


*===========================================================================================================================
****SALM Index
*==========================================================================================================================

***create differened variable for each 
gl salm_dif "cover gr_manu rotate inter relay str_crop mulch fallow imp_fallo_g a_manu compost redu_till terrace trench con_bund"

foreach v of global salm_dif {
gen `v'_dif = `v'_16 - `v'_07
}

gl ind_salm "cover_07 cover_16 cover_dif rotate_07 rotate_16 rotate_dif inter_07 inter_16 inter_dif relay_07 relay_16 relay_dif str_crop_07 str_crop_16 str_crop_dif mulch_07 mulch_16 mulch_dif redu_till_07 redu_till_16 redu_till_dif terrace_07 terrace_16 terrace_dif trench_07 trench_16 trench_dif con_bund_07 con_bund_16 con_bund_dif fallow_07 fallow_16 fallow_dif imp_fallo_g_07 imp_fallo_g_16 imp_fallo_g_dif  a_manu_07 a_manu_16 a_manu_dif  compost_07 compost_16 compost_dif gr_manu_07 gr_manu_16 gr_manu_dif"           

**first compare all HHs in program and non-program areas
eststo clear
eststo, t("Overall Program Area"): qui mean $ind_salm  if prog_area==1 
eststo, t("Vi Group"): qui mean $ind_salm  if vi_group==1
eststo, t("Non-Vi in Prog. Area"): qui mean $ind_salm  if prog_area==1 & vi_group==0 
eststo, t("Non-Program Area"): qui mean $ind_salm if prog_area==0 
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\ind_salm_means.rtf", cells(b(f(2) l(Mean))) lab nostar mti nonum gaps  r


**Program vs. non-program area
eststo clear
local ind_salm cover_07 cover_16 cover_dif rotate_07 rotate_16 rotate_dif inter_07 inter_16 inter_dif relay_07 relay_16 relay_dif str_crop_07 str_crop_16 str_crop_dif mulch_07 mulch_16 mulch_dif redu_till_07 redu_till_16 redu_till_dif terrace_07 terrace_16 terrace_dif trench_07 trench_16 trench_dif con_bund_07 con_bund_16 con_bund_dif fallow_07 fallow_16 fallow_dif imp_fallo_g_07 imp_fallo_g_16 imp_fallo_g_dif  a_manu_07 a_manu_16 a_manu_dif  compost_07 compost_16 compost_dif gr_manu_07 gr_manu_16 gr_manu_dif           

foreach var of local ind_salm {
reg `var' prog_area
eststo
}

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\ind_salm_t-tests_program.csv",  r wide modelwidth(4) b(a2) starl(* 0.1 ** 0.05 *** 0.01) nogaps


eststo clear
local ind_salm cover_07 cover_16 cover_dif rotate_07 rotate_16 rotate_dif inter_07 inter_16 inter_dif relay_07 relay_16 relay_dif str_crop_07 str_crop_16 str_crop_dif mulch_07 mulch_16 mulch_dif redu_till_07 redu_till_16 redu_till_dif terrace_07 terrace_16 terrace_dif trench_07 trench_16 trench_dif con_bund_07 con_bund_16 con_bund_dif fallow_07 fallow_16 fallow_dif imp_fallo_g_07 imp_fallo_g_16 imp_fallo_g_dif  a_manu_07 a_manu_16 a_manu_dif  compost_07 compost_16 compost_dif gr_manu_07 gr_manu_16 gr_manu_dif           

foreach var of local ind_salm {
reg `var' vi_group if prog_area_no_vi==0  
eststo
}

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\ind_salm_t-tests_vi_group.csv",  r wide modelwidth(4) b(a2) starl(* 0.1 ** 0.05 *** 0.01) nogaps


eststo clear
local ind_salm cover_07 cover_16 cover_dif rotate_07 rotate_16 rotate_dif inter_07 inter_16 inter_dif relay_07 relay_16 relay_dif str_crop_07 str_crop_16 str_crop_dif mulch_07 mulch_16 mulch_dif redu_till_07 redu_till_16 redu_till_dif terrace_07 terrace_16 terrace_dif trench_07 trench_16 trench_dif con_bund_07 con_bund_16 con_bund_dif fallow_07 fallow_16 fallow_dif imp_fallo_g_07 imp_fallo_g_16 imp_fallo_g_dif  a_manu_07 a_manu_16 a_manu_dif  compost_07 compost_16 compost_dif gr_manu_07 gr_manu_16 gr_manu_dif           

foreach var of local ind_salm {
reg `var' vi_group if prog_area==1  
eststo
}

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\ind_salm_t-tests_vi_group_in_PA.csv",  r wide modelwidth(4) b(a2) starl(* 0.1 ** 0.05 *** 0.01) nogaps


***compare groups in terms of the overall salm index and its dimensions

rename crop_man_ind_07 salm_ind_d1_07
rename soil_con_ind_07 salm_ind_d2_07
rename fert_man_ind_07 salm_ind_d3_07

rename crop_man_ind_16 salm_ind_d1_16
rename soil_con_ind_16 salm_ind_d2_16
rename fert_man_ind_16 salm_ind_d3_16

rename crop_man_ind_dif salm_ind_d1_dif
rename soil_con_ind_dif salm_ind_d2_dif
rename fert_man_ind_dif salm_ind_d3_dif


gl salm_ind_com "salm_ind_07 salm_ind_16  salm_ind_dif salm_ind_d1_07 salm_ind_d1_16 salm_ind_d1_dif salm_ind_d2_07 salm_ind_d2_16 salm_ind_d2_dif salm_ind_d3_07 salm_ind_d3_16 salm_ind_d3_dif" 

**first compare all HHs in program and non-program areas
eststo clear
eststo, t("Overall Program Area"): qui mean $salm_ind_com  if prog_area==1 
eststo, t("Vi Group"): qui mean $salm_ind_com  if vi_group==1
eststo, t("Non-Vi in Prog. Area"): qui mean $salm_ind_com  if prog_area==1  & vi_group==0 
eststo, t("Non-Program Area"): qui mean $salm_ind_com if prog_area==0 
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\salm_ind_com_means.rtf", cells(b(f(2) l(Mean))) lab nostar mti nonum gaps  r

**Program vs. non-program area
eststo clear
local salm_ind salm_ind_07 salm_ind_16  salm_ind_dif salm_ind_d1_07 salm_ind_d1_16 salm_ind_d1_dif salm_ind_d2_07 salm_ind_d2_16 salm_ind_d2_dif salm_ind_d3_07 salm_ind_d3_16 salm_ind_d3_dif 

foreach var of local salm_ind {
reg `var' prog_area
eststo
}

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\salm_ind_com_t-tests_program.csv",  r wide modelwidth(4) b(a2) starl(* 0.1 ** 0.05 *** 0.01) nogaps

**Vi group vs. non-program area

eststo clear
local salm_ind salm_ind_07 salm_ind_16  salm_ind_dif salm_ind_d1_07 salm_ind_d1_16 salm_ind_d1_dif salm_ind_d2_07 salm_ind_d2_16 salm_ind_d2_dif salm_ind_d3_07 salm_ind_d3_16 salm_ind_d3_dif 

foreach var of local salm_ind {
reg `var' vi_group if prog_area_no_vi==0  
eststo
}

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\salm_ind_com_t-tests_vi_group.csv",  r wide modelwidth(4) b(a2) starl(* 0.1 ** 0.05 *** 0.01) nogaps

eststo clear
local salm_ind salm_ind_07 salm_ind_16  salm_ind_dif salm_ind_d1_07 salm_ind_d1_16 salm_ind_d1_dif salm_ind_d2_07 salm_ind_d2_16 salm_ind_d2_dif salm_ind_d3_07 salm_ind_d3_16 salm_ind_d3_dif 

foreach var of local salm_ind {
reg `var' vi_group if prog_area==1  
eststo
}

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\salm_ind_com_t-tests_vi_group_PA.csv",  r wide modelwidth(4) b(a2) starl(* 0.1 ** 0.05 *** 0.01) nogaps



*****Outcome Analysis

***variables individually correlated with prog_area: res_female res_head res_spo_head r_tech_skill hh_lstock_07 hh_emp_07 elder_headed num_child max_edu_hh soc_07_avg hh_dist_tarma lnd_self_07_2


*** AF income 

g af_sale_16_1000 = (af_prod_sale_16 >1000) if  af_prod_sale_16 !=.

g af_sale_07_1000 = (af_prod_sale_07 >1000) if  af_prod_sale_07 !=.

g af_sale_dif_1000 = (af_prod_sale_dif>1000) if  af_prod_sale_dif !=.

****Generate raw stats

eststo clear

local sale af_prod_sale_16  af_sale_16_1000 af_prod_16_log af_prod_sale_dif af_sale_dif_1000 af_pro_dif_log

estpost tabstat `sale' , statistics(n mean) columns(statistics)
eststo

estpost tabstat `sale' if prog_area==1  , statistics(n mean) columns(statistics)
eststo

estpost tabstat `sale' if prog_area==0 , statistics(n mean) columns(statistics)
eststo
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\sale_unaj_mean.csv", r  nogaps modelwidth(4) cells(mean(f(2))) 

**unajusted t-tests

eststo clear
local sale af_prod_sale_16  af_sale_16_1000 af_prod_16_log af_prod_sale_dif af_sale_dif_1000 af_pro_dif_log
foreach var of local sale {
reg `var' prog_area , robust
eststo
}

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\sale_unaj_ttests.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



eststo clear

local sale af_prod_sale_16  af_sale_16_1000 af_prod_16_log af_prod_sale_dif af_sale_dif_1000 af_pro_dif_log

estpost tabstat `sale', statistics(n median) columns(statistics)
eststo

estpost tabstat `sale' if prog_area==1, statistics(n median) columns(statistics)
eststo

estpost tabstat `sale' if prog_area==0, statistics(n median) columns(statistics)
eststo
esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\sale_unaj_median.csv", r  label nogaps modelwidth(4) cells(p50 (f(2))) 

**unajusted t-tests

eststo clear
local sale af_prod_sale_16  af_sale_16_1000 af_prod_16_log af_prod_sale_dif af_sale_dif_1000 af_pro_dif_log
foreach var of local sale_fw {
qreg `var' prog_area
eststo
}

esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\sale_fw_unaj_qreg.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)


gl sl_cov "res_female res_head res_spo_head r_tech_skill hh_lstock_07 hh_emp_07 elder_headed num_child max_edu_hh soc_07_avg hh_dist_tarma lnd_self_07_2"

***OLS with robust standard errors 

eststo clear

reg af_prod_sale_16 prog_area af_prod_sale_07 $sl_cov i.zone , cluster(groupid)
eststo

probit af_sale_16_1000 prog_area af_sale_07_1000 $sl_cov i.zone, cluster(groupid)
eststo

reg af_prod_16_log prog_area af_prod_07_log  $sl_cov i.zone, cluster(groupid)
eststo

reg af_prod_sale_dif prog_area  $sl_cov i.zone, cluster(groupid)
eststo

probit af_sale_dif_1000  prog_area   $sl_cov i.zone , cluster(groupid)
eststo

reg af_pro_dif_log  prog_area   $sl_cov i.zone , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\sales_ols.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



***IPWRA

**create list of covariates shortlisted with outcome

stepwise, pr (.1): reg af_prod_sale_16 $all_cov samp_z_1  samp_z_3 samp_z_4, r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_af_prod_sale_16 "`X'"

stepwise, pr (.1): probit af_sale_16_1000 $all_cov samp_z_1  samp_z_3 samp_z_4, r  
indeplist, local
*create global for shortlisted (sl) variables 
gl cov_af_sale_16_1000 "`X'"

stepwise, pr (.1): reg af_prod_16_log $all_cov samp_z_1 samp_z_3 samp_z_4, r
indeplist, local
*create global for shortlisted (sl) variables 
gl cov_af_prod_16_log "`X'"

stepwise, pr (.1): reg af_prod_sale_dif $all_cov samp_z_1  samp_z_3 samp_z_4, r
indeplist, local
*create global for shortlisted (sl) variables 
gl cov_af_prod_sale_dif "`X'"

stepwise, pr (.1): probit af_sale_dif_1000 $all_cov samp_z_1  samp_z_3 samp_z_4, r
indeplist, local
*create global for shortlisted (sl) variables 
gl cov_af_sale_dif_1000 "`X'"

stepwise, pr (.1): reg af_pro_dif_log $all_cov samp_z_1  samp_z_3 samp_z_4, r
indeplist, local
*create global for shortlisted (sl) variables 
gl cov_af_af_pro_dif_log "`X'"

eststo clear
**no covergence with first variable

teffects ipwra (af_sale_16_1000  af_sale_07_1000 $cov_af_sale_16_1000 $sl_cov  i.zone, probit) (prog_area af_sale_07_1000 $sl_cov i.zone, probit), vce(r)
eststo
teffects ipwra (af_prod_16_log  af_prod_07_log $cov_af_prod_16_log $sl_cov i.zone) (prog_area af_prod_07_log $sl_cov i.zone, probit), vce(r)
eststo

teffects ipwra (af_sale_dif_1000 $cov_af_sale_dif_1000 $sl_cov i.zone, probit) (prog_area  $sl_cov i.zone, probit), vce(r)
eststo
teffects ipwra (af_pro_dif_log  $cov_af_pro_dif_log $sl_cov i.zone) (prog_area $sl_cov i.zone, probit), vce(r)
eststo

esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\sales_ipwra.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



***robust regression for continuous outcomes 

**not possible for this outcome, given so many 0 values


***PSM

**outcomes: af_prod_sale_16 af_sale_16_1000 f_prod_16_log af_prod_sale_dif af_sale_dif_1000 af_pro_dif_log

eststo clear

teffects nnmatch (af_prod_sale_16 af_prod_sale_07 $sl_cov) (prog_area),  ematch(zone) biasadj(af_prod_sale_07 num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (af_sale_16_1000 af_sale_07_1000 $sl_cov) (prog_area),  ematch(zone) biasadj(num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (af_prod_16_log af_prod_07_log $sl_cov) (prog_area),  ematch(zone) biasadj(af_prod_07_log num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (af_prod_sale_dif  $sl_cov) (prog_area),  ematch(zone) biasadj( num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (af_sale_dif_1000  $sl_cov) (prog_area),  ematch(zone) biasadj(num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (af_pro_dif_log  $sl_cov) (prog_area),  ematch(zone) biasadj(num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo


esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\sales_nn.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



***2SLS
eststo clear

ivregress 2sls af_prod_sale_16 af_prod_sale_07 $sl_cov i.zone (vi_group = prog_area af_prod_sale_07 $sl_cov), cluster(groupid) 
eststo

ivprobit af_sale_16_1000 af_sale_07_1000 $sl_cov i.zone (vi_group = prog_area af_sale_07_1000 $sl_cov), vce(cluster groupid)
eststo

ivregress 2sls af_prod_16_log af_prod_07_log $sl_cov i.zone (vi_group = prog_area af_prod_07_log $sl_cov), cluster(groupid) 
eststo

ivregress 2sls af_prod_sale_dif  $sl_cov i.zone (vi_group = prog_area  $sl_cov), cluster(groupid) 
eststo

ivprobit af_sale_dif_1000  $sl_cov i.zone (vi_group = prog_area  $sl_cov), vce(cluster groupid)
eststo

ivregress 2sls af_pro_dif_log $sl_cov i.zone (vi_group = prog_area  $sl_cov), cluster(groupid) 
eststo

esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\sales_2sls.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



*examine zone specific differences

**variables: edu_prog edu_prog_any edu_prog_all edu_spe edu_spe_log edu_spe_abv_med eco_lad eco_lad_1p
**outcomes: af_prod_sale_16 af_sale_16_1000 af_prod_16_log af_prod_sale_dif af_sale_dif_1000 af_pro_dif_log

eststo clear
 
reg af_prod_sale_16 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa af_prod_sale_07 $sl_cov i.zone , cluster(groupid)
eststo
probit af_sale_16_1000 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa af_sale_07_1000 $sl_cov i.zone , cluster(groupid)
eststo
reg af_prod_16_log samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa af_prod_07_log $sl_cov i.zone , cluster(groupid)
eststo
reg af_prod_sale_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
eststo
probit af_sale_dif_1000 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
eststo
reg af_pro_dif_log samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\sale_vsz_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

***implement Wald test to assess how different coefficients are

**af_prod_sale_16

eststo clear

reg af_prod_sale_16 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa af_prod_sale_07 $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg af_prod_sale_16 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa af_prod_sale_07 $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg af_prod_sale_16 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa af_prod_sale_07 $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg af_prod_sale_16 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa af_prod_sale_07 $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg af_prod_sale_16 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa af_prod_sale_07 $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg af_prod_sale_16 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa af_prod_sale_07 $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 


**af_sale_16_1000

eststo clear

probit af_sale_16_1000 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa af_sale_07_1000 $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

probit af_sale_16_1000 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa af_sale_07_1000 $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

probit af_sale_16_1000 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa af_sale_07_1000 $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

probit af_sale_16_1000 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa af_sale_07_1000 $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

probit af_sale_16_1000 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa af_sale_07_1000 $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

probit af_sale_16_1000 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa af_sale_07_1000 $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 


**af_prod_16_log

eststo clear

reg af_prod_16_log samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa af_prod_07_log  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg af_prod_16_log samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa af_prod_07_log  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg af_prod_16_log samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa af_prod_07_log   $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg af_prod_16_log samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa af_prod_07_log  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg af_prod_16_log samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa af_prod_07_log   $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg af_prod_16_log samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa af_prod_07_log  $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 



**af_prod_sale_dif 

eststo clear

reg af_prod_sale_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg af_prod_sale_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg af_prod_sale_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg af_prod_sale_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg af_prod_sale_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg af_prod_sale_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 


**af_sale_dif_1000 

eststo clear

probit af_sale_dif_1000  samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

probit af_sale_dif_1000  samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa   $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

probit af_sale_dif_1000  samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

probit af_sale_dif_1000  samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

probit af_sale_dif_1000  samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

probit af_sale_dif_1000  samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 



**af_pro_dif_log 

eststo clear

reg af_pro_dif_log    samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg af_pro_dif_log    samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg af_pro_dif_log    samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg af_pro_dif_log    samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg af_pro_dif_log    samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg af_pro_dif_log    samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 




***Differential effects -- Gender

**gen treatment dummies for female and male
g prog_area_f = (res_female==1 & prog_area==1)
g prog_area_m = (res_female==0 & prog_area==1)


**examine gender specific differences

eststo clear

reg af_prod_sale_16 prog_area_f prog_area_m res_female af_prod_sale_07  $sl_cov i.zone  , cluster(groupid)
eststo

probit af_sale_16_1000 prog_area_f prog_area_m res_female af_sale_07_1000 $sl_cov i.zone  , cluster(groupid)
eststo

reg af_prod_16_log prog_area_f prog_area_m res_female af_prod_07_log  $sl_cov i.zone  , cluster(groupid)
eststo

reg af_prod_sale_dif prog_area_f prog_area_m res_female  $sl_cov i.zone  , cluster(groupid)
eststo

probit af_sale_dif_1000 prog_area_f prog_area_m res_female   $sl_cov i.zone  , cluster(groupid)
eststo

reg af_pro_dif_log prog_area_f prog_area_m res_female   $sl_cov i.zone  , cluster(groupid)
eststo


esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\sale_gen_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)


**Wald tests for gender

eststo clear

reg af_prod_sale_16 prog_area_f prog_area_m res_female  af_prod_sale_07 $sl_cov i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

probit af_sale_16_1000 prog_area_f prog_area_m res_female af_sale_07_1000  $sl_cov i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg af_prod_16_log prog_area_f prog_area_m res_female af_prod_07_log $sl_cov  i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg af_prod_sale_dif  prog_area_f prog_area_m res_female  $sl_cov i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

probit af_sale_dif_1000 prog_area_f prog_area_m res_female   $sl_cov i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg af_pro_dif_log prog_area_f prog_area_m res_female   $sl_cov i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,   stats(test test_prob) 




***Differential effects -- Sex of HH Head


**gen treatment dummies for female and male
g prog_area_f_h_h = (fem_headed==1 & prog_area==1)
g prog_area_m_h_h = (fem_headed==0 & prog_area==1)


eststo clear

reg af_prod_sale_16 prog_area_f_h prog_area_m_h fem_headed af_prod_sale_07  $sl_cov i.zone  , cluster(groupid)
eststo

probit af_sale_16_1000 prog_area_f_h prog_area_m_h fem_headed af_sale_07_1000 $sl_cov i.zone  , cluster(groupid)
eststo

probit af_prod_16_log prog_area_f_h prog_area_m_h fem_headed af_prod_07_log $sl_cov i.zone  , cluster(groupid)
eststo

reg af_prod_sale_dif prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
eststo

probit af_sale_dif_1000 prog_area_f_h prog_area_m_h fem_headed   $sl_cov i.zone  , cluster(groupid)
eststo

reg af_pro_dif_log prog_area_f_h prog_area_m_h fem_headed   $sl_cov i.zone  , cluster(groupid)
eststo


esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\sales_fhh_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

***variables: af_prod_sale_16 af_sale_16_1000 af_prod_sale_16 af_sale_16_1000 af_prod_sale_dif af_sale_dif_1000 af_pro_dif_log eco_lad_1p lstock_dif_p

eststo clear

reg af_prod_sale_16 prog_area_f_h prog_area_m_h fem_headed af_prod_sale_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

probit af_sale_16_1000 prog_area_f_h prog_area_m_h fem_headed af_sale_07_1000  $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg af_prod_16_log prog_area_f_h prog_area_m_h fem_headed af_prod_07_log $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg af_prod_sale_dif  prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

probit af_sale_dif_1000 prog_area_f_h prog_area_m_h fem_headed   $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg af_pro_dif_log prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f


estout a b c d e f ,  stats(test test_prob) 



***Differential effects -- Education of respondent

**gen treatment dummies
g prog_area_8p_edu = (educat_res>7 & prog_area==1)
g prog_area_8u_edu = (educat_res<8 & prog_area==1)

g res_over_7_edu = (educat_res>7)

***variables: af_prod_sale_16 af_sale_16_1000 af_prod_sale_16 af_sale_16_1000 af_prod_sale_dif af_sale_dif_1000 af_pro_dif_log eco_lad_1p lstock_dif_p

eststo clear

reg af_prod_sale_16 prog_area_8p_edu prog_area_8u_edu res_over_7_edu  af_prod_sale_07 $sl_cov i.zone  , cluster(groupid)
eststo

probit af_sale_16_1000 prog_area_8p_edu prog_area_8u_edu res_over_7_edu af_sale_07_1000 $sl_cov i.zone  , cluster(groupid)
eststo

reg af_prod_16_log prog_area_8p_edu prog_area_8u_edu res_over_7_edu af_prod_07_log   $sl_cov i.zone  , cluster(groupid)
eststo

reg af_prod_sale_dif prog_area_8p_edu prog_area_8u_edu res_over_7_edu   $sl_cov i.zone  , cluster(groupid)
eststo

probit af_sale_dif_1000 prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov i.zone  , cluster(groupid)
eststo

reg af_pro_dif_log prog_area_8p_edu prog_area_8u_edu res_over_7_edu   $sl_cov i.zone  , cluster(groupid)
eststo


esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\sales_edu_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests for edu

***variables: af_prod_sale_16 af_sale_16_1000 af_prod_sale_16 af_sale_16_1000 af_prod_sale_dif af_sale_dif_1000 af_pro_dif_log eco_lad_1p 

eststo clear

reg af_prod_sale_16 prog_area_8p_edu prog_area_8u_edu res_over_7_edu af_prod_sale_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

probit af_sale_16_1000 prog_area_8p_edu prog_area_8u_edu res_over_7_edu af_sale_07_1000  $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg af_prod_16_log  prog_area_8p_edu prog_area_8u_edu res_over_7_edu af_prod_07_log $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg af_prod_sale_dif prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

probit af_sale_dif_1000 prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg af_pro_dif_log prog_area_8p_edu prog_area_8u_edu res_over_7_edu   $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f


estout a b c d e f ,  stats(test test_prob) 



***Differential effects -- Baseline Wealth

**gen treatment dummies 
xtile a_pca_07_by_z_by_z_bin =  a_pca_07_by_z , n(2)

g prog_area_asset_poor = (a_pca_07_by_z_bin==1 & prog_area==1)
g prog_area_asset_rich = (a_pca_07_by_z_bin==2 & prog_area==1)

g bl_asset_rich = (a_pca_07_by_z_bin==2)
g bl_asset_poor = (a_pca_07_by_z_bin==1)

***variables: af_prod_sale_16 af_sale_16_1000 af_prod_sale_16 af_sale_16_1000 af_prod_sale_dif af_sale_dif_1000 af_pro_dif_log 

**examine sub-group specific differences

eststo clear

reg af_prod_sale_16 prog_area_asset_poor prog_area_asset_rich bl_asset_poor af_prod_sale_07 $sl_cov i.zone  , cluster(groupid)
eststo

probit af_sale_16_1000 prog_area_asset_poor prog_area_asset_rich bl_asset_poor af_sale_07_1000 $sl_cov i.zone  , cluster(groupid)
eststo

reg af_prod_16_log prog_area_asset_poor prog_area_asset_rich bl_asset_poor af_prod_07_log $sl_cov i.zone  , cluster(groupid)
eststo

reg af_prod_sale_dif prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov i.zone  , cluster(groupid)
eststo

probit af_sale_dif_1000 prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov i.zone  , cluster(groupid)
eststo

reg af_pro_dif_log prog_area_asset_poor prog_area_asset_rich bl_asset_poor   $sl_cov i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\sales_wealth_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

***variables: af_prod_sale_16 af_sale_16_1000 af_prod_sale_16 af_sale_16_1000 af_prod_sale_dif af_sale_dif_1000 af_pro_dif_log eco_lad_1p 

eststo clear

reg af_prod_sale_16 prog_area_asset_poor prog_area_asset_rich bl_asset_poor af_prod_sale_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

probit af_sale_16_1000 prog_area_asset_poor prog_area_asset_rich bl_asset_poor af_sale_07_1000  $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg af_prod_16_log prog_area_asset_poor prog_area_asset_rich bl_asset_poor  af_prod_07_log $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg af_prod_sale_dif prog_area_asset_poor prog_area_asset_rich bl_asset_poor   $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

probit af_sale_dif_1000 prog_area_asset_poor prog_area_asset_rich bl_asset_poor $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg af_pro_dif_log prog_area_asset_poor prog_area_asset_rich bl_asset_poor   $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f ,  stats(test test_prob) 



***Differential effects -- Land Holding Size

**gen treatment dummies

g prog_area_land_u2 = (land_bl<2 & prog_area==1)
g prog_area_land_o2 = (land_b>=2 & prog_area==1)

g land_o2 = (land_b>=2)

***variables: af_prod_sale_16 af_sale_16_1000 af_prod_sale_16 af_sale_16_1000 af_prod_sale_dif af_sale_dif_1000 af_pro_dif_log eco_lad_1p 

**examine sub-group specific differences

eststo clear

reg af_prod_sale_16 prog_area_land_u2 prog_area_land_o2 land_o2 af_prod_sale_07 $sl_cov i.zone  , cluster(groupid)
eststo

probit af_sale_16_1000 prog_area_land_u2 prog_area_land_o2 land_o2 af_sale_07_1000  $sl_cov i.zone  , cluster(groupid)
eststo

reg af_prod_16_log prog_area_land_u2 prog_area_land_o2 land_o2 af_prod_07_log $sl_cov i.zone  , cluster(groupid)
eststo

reg af_prod_sale_dif prog_area_land_u2 prog_area_land_o2 land_o2 $sl_cov i.zone  , cluster(groupid)
eststo

probit af_sale_dif_1000 prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
eststo

reg af_pro_dif_log prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
eststo


esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\sales_land_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests for edu

***variables: af_prod_sale_16 af_sale_16_1000 af_prod_sale_16 af_sale_16_1000 af_prod_sale_dif af_sale_dif_1000 af_pro_dif_log eco_lad_1p

eststo clear

reg af_prod_sale_16 prog_area_land_u2 prog_area_land_o2 land_o2 af_prod_sale_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

probit af_sale_16_1000 prog_area_land_u2 prog_area_land_o2 land_o2 af_sale_07_1000 $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg af_prod_16_log prog_area_land_u2 prog_area_land_o2 land_o2 af_prod_07_log $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg af_prod_sale_dif prog_area_land_u2 prog_area_land_o2 land_o2   $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

probit af_sale_dif_1000 prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg af_pro_dif_log prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f


estout a b c d e f,  stats(test test_prob) 


***Differential effects -- Dairy Farmers

**gen treatment dummies

g prog_area_dar = (dar_prod==1 & prog_area==1)
g prog_area_no_dar = (dar_prod==0 & prog_area==1)

**examine sub-group specific differences

***variables: af_prod_sale_16 af_sale_16_1000 af_prod_sale_16 af_sale_16_1000 af_prod_sale_dif af_sale_dif_1000 af_pro_dif_log eco_lad_1p 


eststo clear

reg af_prod_sale_16 prog_area_dar prog_area_no_dar dar_prod af_prod_sale_07 $sl_cov i.zone  , cluster(groupid)
eststo

probit af_sale_16_1000 prog_area_dar prog_area_no_dar dar_prod af_sale_07_1000 $sl_cov i.zone  , cluster(groupid)
eststo

reg af_prod_16_log prog_area_dar prog_area_no_dar dar_prod af_prod_07_log  $sl_cov i.zone  , cluster(groupid)
eststo

reg af_prod_sale_dif prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
eststo

probit af_sale_dif_1000 prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
eststo

reg af_pro_dif_log prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
eststo


esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\dar_sales_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

***variables: af_prod_sale_16 af_sale_16_1000 af_prod_sale_16 af_sale_16_1000 af_prod_sale_dif af_sale_dif_1000 af_pro_dif_log eco_lad_1p 

eststo clear

reg af_prod_sale_16 prog_area_dar prog_area_no_dar dar_prod af_prod_sale_07 $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

probit af_sale_16_1000 prog_area_dar prog_area_no_dar dar_prod af_sale_07_1000 $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg af_prod_16_log prog_area_dar prog_area_no_dar dar_prod af_prod_07_log  $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg af_prod_sale_dif prog_area_dar prog_area_no_dar dar_prod   $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

probit af_sale_dif_1000 prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg af_pro_dif_log prog_area_dar prog_area_no_dar dar_prod   $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f


estout a b c d e f  ,  stats(test test_prob) 



***Differential effects -- Official Position

**gen treatment dummies

g prog_area_OP = (official_role_res==1 & prog_area==1)
g prog_area_no_OP = (official_role_res==0 & prog_area==1)


**examine sub-group specific differences

***variables: af_prod_sale_16 af_sale_16_1000 af_prod_sale_16 af_sale_16_1000 af_prod_sale_dif af_sale_dif_1000 af_pro_dif_log eco_lad_1p

eststo clear

reg af_prod_sale_16 prog_area_OP prog_area_no_OP official_role af_prod_sale_07  $sl_cov i.zone  , cluster(groupid)
eststo

probit af_sale_16_1000 prog_area_OP prog_area_no_OP official_role af_sale_07_1000  $sl_cov i.zone  , cluster(groupid)
eststo

reg af_prod_16_log prog_area_OP prog_area_no_OP official_role af_prod_07_log $sl_cov i.zone  , cluster(groupid)
eststo

reg af_prod_sale_dif prog_area_OP prog_area_no_OP official_role  $sl_cov i.zone  , cluster(groupid)
eststo

probit af_sale_dif_1000 prog_area_OP prog_area_no_OP official_role  $sl_cov i.zone  , cluster(groupid)
eststo

reg af_pro_dif_log prog_area_OP prog_area_no_OP official_role  $sl_cov i.zone  , cluster(groupid)
eststo


esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\sales_OP_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

***variables: af_prod_sale_16 af_sale_16_1000 af_prod_sale_16 af_sale_16_1000 af_prod_sale_dif af_sale_dif_1000 af_pro_dif_log eco_lad_1p

eststo clear

reg af_prod_sale_16 prog_area_OP prog_area_no_OP official_role  af_prod_sale_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

probit af_sale_16_1000 prog_area_OP prog_area_no_OP official_role af_sale_07_1000  $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg af_prod_16_log prog_area_OP prog_area_no_OP official_role  af_prod_07_log $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg af_prod_sale_dif prog_area_OP prog_area_no_OP official_role   $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

probit af_sale_dif_1000 prog_area_OP prog_area_no_OP official_role  $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg af_pro_dif_log prog_area_OP prog_area_no_OP official_role  $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f



estout a b c d e f,  stats(test test_prob) 






****Firewood cash value from farm & collection time

***all variables: fw_cash_val_16 fw_cash_val_07 fw_cash_val_dif fw_hour_16 fw_hour_07 fw_hour_dif fw_hr_log_16 fw_hr_dif_07 fw_hr_dif_log

eststo clear

local fw fw_cash_val_16 fw_val_log_16 fw_cash_val_dif fw_val_log_dif fw_hour_16 fw_hr_log_16 fw_hour_dif  fw_hr_dif_log

estpost tabstat `fw' , statistics(n mean) columns(statistics)
eststo

estpost tabstat `fw' if prog_area==1  , statistics(n mean) columns(statistics)
eststo

estpost tabstat `fw' if prog_area==0 , statistics(n mean) columns(statistics)
eststo
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\fw_unaj_mean.csv", r  nogaps modelwidth(4) cells(mean(f(2))) 

**unajusted t-tests

eststo clear
local fw fw_cash_val_16 fw_val_log_16 fw_cash_val_dif fw_val_log_dif fw_hour_16 fw_hr_log_16 fw_hour_dif  fw_hr_dif_log
foreach var of local fw {
reg `var' prog_area , robust
eststo
}

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\fw_unaj_ttests.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



eststo clear

local fw fw_cash_val_16 fw_val_log_16 fw_cash_val_dif fw_val_log_dif fw_hour_16 fw_hr_log_16 fw_hour_dif  fw_hr_dif_log

estpost tabstat `fw', statistics(n median) columns(statistics)
eststo

estpost tabstat `fw' if prog_area==1, statistics(n median) columns(statistics)
eststo

estpost tabstat `fw' if prog_area==0, statistics(n median) columns(statistics)
eststo
esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\fw_unaj_median.csv", r  label nogaps modelwidth(4) cells(p50 (f(2))) 

**unajusted t-tests

eststo clear
local fw fw_cash_val_16 fw_val_log_16 fw_cash_val_dif fw_val_log_dif fw_hour_16 fw_hour_dif fw_hr_log_16 fw_hr_dif_log
foreach var of local fw {
qreg `var' prog_area
eststo
}

esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\fw_unaj_qreg.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)


gl sl_cov "res_female res_head res_spo_head r_tech_skill hh_lstock_07 hh_emp_07 elder_headed num_child max_edu_hh soc_07_avg hh_dist_tarma lnd_self_07_2"

***OLS with clustered standard errors

***variables: fw_cash_val_16 fw_val_log_16 fw_cash_val_dif fw_val_log_dif fw_hour_16  fw_hr_log_16 fw_hour_dif fw_hr_dif_log

eststo clear

reg fw_cash_val_16 prog_area fw_cash_val_07 $sl_cov i.zone , cluster(groupid)
eststo

reg fw_val_log_16 prog_area fw_val_log_07 $sl_cov i.zone , cluster(groupid)
eststo

reg fw_cash_val_dif prog_area $sl_cov i.zone, cluster(groupid)
eststo

reg fw_val_log_dif  prog_area $sl_cov i.zone, cluster(groupid)
eststo

reg fw_hour_16  prog_area fw_hour_07 $sl_cov i.zone , cluster(groupid)
eststo

reg fw_hr_log_16  prog_area fw_hr_log_07   $sl_cov i.zone , cluster(groupid)
eststo

reg fw_hour_dif  prog_area  $sl_cov i.zone , cluster(groupid)
eststo

reg fw_hr_dif_log  prog_area   $sl_cov i.zone , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\fw_ols.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



***IPWRA

***variables: fw_cash_val_16 fw_val_log_16 fw_cash_val_dif fw_val_log_dif fw_hour_16  fw_hr_log_16 fw_hour_dif fw_hr_dif_log

****first shortlist coveriates correlated with outcome
stepwise, pr (.1): reg fw_cash_val_16 $all_cov samp_z_1  samp_z_3 samp_z_4, r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_fw_cash_val_16 "`X'"

stepwise, pr (.1): reg fw_val_log_16 $all_cov samp_z_1  samp_z_3 samp_z_4, r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_fw_val_log_16 "`X'"

stepwise, pr (.1): reg fw_cash_val_dif $all_cov samp_z_1  samp_z_3 samp_z_4, r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_fw_cash_val_dif "`X'"

stepwise, pr (.1): reg fw_val_log_dif $all_cov samp_z_1  samp_z_3 samp_z_4, r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_fw_val_log_dif "`X'"

stepwise, pr (.1): reg fw_hour_16 $all_cov samp_z_1  samp_z_3 samp_z_4, r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_fw_hour_16 "`X'"

stepwise, pr (.1): reg fw_hr_log_16 $all_cov samp_z_1  samp_z_3 samp_z_4, r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_fw_hr_log_16 "`X'"

stepwise, pr (.1): reg fw_hour_dif $all_cov samp_z_1  samp_z_3 samp_z_4, r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_fw_hour_dif "`X'"

stepwise, pr (.1): reg fw_hr_dif_log $all_cov samp_z_1  samp_z_3 samp_z_4, r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_fw_hr_dif_log "`X'"

eststo clear
teffects ipwra (fw_cash_val_16 fw_cash_val_07 $cov_fw_cash_val_16 $sl_cov i.zone) (prog_area fw_cash_val_07 $sl_cov i.zone, probit), vce(r)
eststo
teffects ipwra (fw_val_log_16 fw_val_log_07 $cov_fw_val_log_16 $sl_cov i.zone) (prog_area fw_val_log_07 $sl_cov i.zone, probit), vce(r)
eststo
teffects ipwra (fw_cash_val_dif $cov_fw_cash_val_dif $sl_cov i.zone) (prog_area  $sl_cov i.zone, probit), vce(r)
eststo
teffects ipwra (fw_val_log_dif $cov_fw_val_log_dif $sl_cov i.zone) (prog_area  $sl_cov i.zone, probit), vce(r)
eststo

teffects ipwra (fw_hour_16  fw_hour_07 $cov_fw_hour_16 $sl_cov i.zone) (prog_area fw_hour_07  $sl_cov i.zone, probit), vce(r)
eststo
teffects ipwra (fw_hr_log_16 fw_hr_log_07 $cov_fw_hr_log_16 $sl_cov i.zone) (prog_area fw_hr_log_07 $sl_cov i.zone, probit), vce(r)
eststo
teffects ipwra (fw_hour_dif $cov_fw_hour_dif $sl_cov i.zone) (prog_area  $sl_cov i.zone, probit), vce(r)
eststo
teffects ipwra (fw_hr_dif_log $cov_fw_hr_dif_log $sl_cov i.zone) (prog_area  $sl_cov i.zone, probit), vce(r)
eststo

esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\fw_ipwra.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



***robust regression for continuous outcomes 

eststo clear

rreg fw_cash_val_16 prog_area fw_cash_val_07 $sl_cov i.zone 
eststo

rreg fw_val_log_16 prog_area fw_val_log_07 $sl_cov i.zone 
eststo

rreg fw_cash_val_dif prog_area $sl_cov i.zone
eststo

rreg fw_val_log_dif  prog_area $sl_cov i.zone
eststo

rreg fw_hour_16  prog_area fw_hour_07 $sl_cov i.zone 
eststo

rreg fw_hr_log_16  prog_area fw_hr_log_07   $sl_cov i.zone 
eststo

rreg fw_hour_dif  prog_area  $sl_cov i.zone 
eststo

rreg fw_hr_dif_log  prog_area   $sl_cov i.zone 
eststo

esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\fw_rreg.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



***PSM

***variables: fw_cash_val_16 fw_val_log_16 fw_cash_val_dif fw_val_log_dif fw_hour_16  fw_hr_log_16 fw_hour_dif fw_hr_dif_log
eststo clear

teffects nnmatch (fw_cash_val_16 fw_cash_val_07 $sl_cov) (prog_area),  ematch(zone) biasadj(fw_cash_val_07 num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (fw_val_log_16 fw_val_log_07 $sl_cov) (prog_area),  ematch(zone) biasadj(fw_val_log_07 num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (fw_cash_val_dif  $sl_cov) (prog_area),  ematch(zone) biasadj(num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (fw_val_log_dif $sl_cov) (prog_area),  ematch(zone) biasadj(num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (fw_hour_16 fw_hour_07 $sl_cov) (prog_area),  ematch(zone) biasadj(fw_hour_07 num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (fw_hr_log_16 fw_hr_log_07  $sl_cov) (prog_area),  ematch(zone) biasadj(fw_hr_log_07 num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (fw_hour_dif  $sl_cov) (prog_area),  ematch(zone) biasadj(num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (fw_hr_dif_log  $sl_cov) (prog_area),  ematch(zone) biasadj(num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\fw_nn.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)


eststo clear

qreg fw_cash_val_16 prog_area fw_cash_val_07 $sl_cov i.zone 
eststo

qreg fw_val_log_16 prog_area fw_val_log_07 $sl_cov i.zone 
eststo

qreg fw_cash_val_dif prog_area $sl_cov i.zone
eststo

qreg fw_val_log_dif  prog_area $sl_cov i.zone
eststo

qreg fw_hour_16  prog_area fw_hour_07 $sl_cov i.zone 
eststo

qreg fw_hr_log_16  prog_area fw_hr_log_07   $sl_cov i.zone 
eststo

qreg fw_hour_dif  prog_area  $sl_cov i.zone 
eststo

qreg fw_hr_dif_log  prog_area   $sl_cov i.zone 
eststo

esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\fw_qreg.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)




***2SLS

***variables: fw_cash_val_16 fw_val_log_16 fw_cash_val_dif fw_val_log_dif fw_hour_16  fw_hr_log_16 fw_hour_dif fw_hr_dif_log

eststo clear

ivregress 2sls fw_cash_val_16 fw_cash_val_07 $sl_cov i.zone (vi_group = prog_area fw_cash_val_07 $sl_cov), cluster(groupid) 
eststo

ivregress 2sls fw_val_log_16 fw_val_log_07 $sl_cov i.zone (vi_group = prog_area fw_val_log_07 $sl_cov), cluster(groupid) 
eststo

ivregress 2sls fw_cash_val_dif $sl_cov i.zone (vi_group = prog_area  $sl_cov), cluster(groupid) 
eststo

ivregress 2sls fw_val_log_dif $sl_cov i.zone (vi_group = prog_area  $sl_cov), cluster(groupid) 
eststo

ivregress 2sls fw_hour_16 fw_hour_07 $sl_cov i.zone (vi_group = prog_area fw_hour_07 $sl_cov), cluster(groupid) 
eststo

ivregress 2sls fw_hr_log_16 fw_hr_log_07 $sl_cov i.zone (vi_group = prog_area fw_hr_log_07 $sl_cov), cluster(groupid) 
eststo

ivregress 2sls fw_hour_dif $sl_cov i.zone (vi_group = prog_area fw_val_log_dif $sl_cov), cluster(groupid) 
eststo

ivregress 2sls fw_hr_dif_log $sl_cov i.zone (vi_group = prog_area fw_val_log_dif $sl_cov), cluster(groupid) 
eststo

esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\fw_2sls.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)


***variables: fw_cash_val_16 fw_val_log_16 fw_cash_val_dif fw_val_log_dif fw_hour_16  fw_hr_log_16 fw_hour_dif fw_hr_dif_log


*examine zone specific differences

**variables: edu_prog edu_prog_any edu_prog_all edu_spe edu_spe_log edu_spe_abv_med eco_lad eco_lad_1p

eststo clear
 
reg fw_cash_val_16 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa fw_cash_val_07 $sl_cov i.zone , cluster(groupid)
eststo
reg fw_val_log_16 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa fw_val_log_07 $sl_cov i.zone , cluster(groupid)
eststo
reg fw_cash_val_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
eststo
reg fw_val_log_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
eststo
reg fw_hour_16 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa fw_hour_07 $sl_cov i.zone , cluster(groupid)
eststo
reg fw_hr_log_16 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa fw_hr_log_07 $sl_cov i.zone , cluster(groupid)
eststo
reg fw_hour_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa   $sl_cov i.zone , cluster(groupid)
eststo
reg fw_hr_dif_log samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa $sl_cov i.zone , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\fw_vsz_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

***implement Wald test to assess how different coefficients are

**fw_cash_val_16

eststo clear

reg fw_cash_val_16 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa fw_cash_val_07 $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg fw_cash_val_16 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa fw_cash_val_07 $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg fw_cash_val_16 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa fw_cash_val_07 $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg fw_cash_val_16 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa fw_cash_val_07 $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg fw_cash_val_16 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa fw_cash_val_07 $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg fw_cash_val_16 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa fw_cash_val_07 $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 


**fw_val_log_16

eststo clear

reg fw_val_log_16 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa fw_val_log_07 $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg fw_val_log_16 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa fw_val_log_07 $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg fw_val_log_16 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa fw_val_log_07  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg fw_val_log_16 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa fw_val_log_07 $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg fw_val_log_16 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa fw_val_log_07 $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg fw_val_log_16 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa fw_val_log_07  $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 


**fw_cash_val_dif

eststo clear

reg fw_cash_val_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg fw_cash_val_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg fw_cash_val_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg fw_cash_val_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg fw_cash_val_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg fw_cash_val_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 

**fw_val_log_dif 

eststo clear

reg fw_val_log_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg fw_val_log_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg fw_val_log_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg fw_val_log_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg fw_val_log_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg fw_val_log_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 


**fw_hour_16 

eststo clear

reg fw_hour_16  samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa fw_hour_07 $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg fw_hour_16  samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa fw_hour_07  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg fw_hour_16  samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa fw_hour_07 $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg fw_hour_16  samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa fw_hour_07 $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg fw_hour_16  samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa fw_hour_07 $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg fw_hour_16  samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa fw_hour_07 $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 



**fw_hr_log_16 

eststo clear

reg fw_hr_log_16    samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa fw_hr_log_07 $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg fw_hr_log_16    samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa fw_hr_log_07 $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg fw_hr_log_16    samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa fw_hr_log_07 $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg fw_hr_log_16    samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa fw_hr_log_07 $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg fw_hr_log_16    samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa fw_hr_log_07 $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg fw_hr_log_16    samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa fw_hr_log_07 $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 


**fw_hr_dif_log 

eststo clear

reg fw_hour_dif     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg fw_hour_dif     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg fw_hour_dif     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg fw_hour_dif     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg fw_hour_dif     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg fw_hour_dif     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 

**fw_hr_dif_log 

eststo clear

reg fw_hr_dif_log     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg fw_hr_dif_log     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg fw_hr_dif_log     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg fw_hr_dif_log     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg fw_hr_dif_log     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg fw_hr_dif_log     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 



***Differential effects -- Gender

**gen treatment dummies for female and male
g prog_area_f = (res_female==1 & prog_area==1)
g prog_area_m = (res_female==0 & prog_area==1)


**examine gender specific differences

eststo clear

reg fw_cash_val_16 prog_area_f prog_area_m res_female fw_cash_val_07  $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_val_log_16 prog_area_f prog_area_m res_female fw_val_log_07 $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_cash_val_dif prog_area_f prog_area_m res_female   $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_val_log_dif prog_area_f prog_area_m res_female  $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_hour_16 prog_area_f prog_area_m res_female fw_hour_07  $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_hr_log_16 prog_area_f prog_area_m res_female  fw_hr_log_07 $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_hour_dif prog_area_f prog_area_m res_female  $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_hr_dif_log prog_area_f prog_area_m res_female  $sl_cov i.zone  , cluster(groupid)
eststo


esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\fw_gen_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)


**Wald tests for gender

***variables: fw_cash_val_16 fw_val_log_16 fw_cash_val_16 fw_val_log_16 fw_val_log_dif fw_hour_16 fw_hr_log_16 fw_hr_dif_log lstock_dif_p

eststo clear

reg fw_cash_val_16 prog_area_f prog_area_m res_female fw_cash_val_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg fw_val_log_16 prog_area_f prog_area_m res_female fw_val_log_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg fw_cash_val_dif prog_area_f prog_area_m res_female $sl_cov  i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg fw_val_log_dif  prog_area_f prog_area_m res_female  $sl_cov i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg fw_hour_16 prog_area_f prog_area_m res_female fw_hour_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg fw_hr_log_16 prog_area_f prog_area_m res_female  fw_hr_log_07 $sl_cov i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg fw_hour_dif  prog_area_f prog_area_m res_female  $sl_cov i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg fw_hr_dif_log  prog_area_f prog_area_m res_female  $sl_cov i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

estout a b c d e f g h,  stats(test test_prob) 




***Differential effects -- Sex of HH Head


**gen treatment dummies for female and male
g prog_area_f_h_h = (fem_headed==1 & prog_area==1)
g prog_area_m_h_h = (fem_headed==0 & prog_area==1)


eststo clear

reg fw_cash_val_16 prog_area_f_h prog_area_m_h fem_headed fw_cash_val_07  $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_val_log_16 prog_area_f_h prog_area_m_h fem_headed fw_val_log_07  $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_cash_val_dif prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_val_log_dif prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_hour_16 prog_area_f_h prog_area_m_h fem_headed  fw_hour_07 $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_hr_log_16 prog_area_f_h prog_area_m_h fem_headed fw_hr_log_07  $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_hour_dif prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_hr_dif_log prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
eststo


esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\fw_fhh_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

***variables: fw_cash_val_16 fw_val_log_16 fw_cash_val_16 fw_val_log_16 fw_val_log_dif fw_hour_16 fw_hr_log_16 fw_hr_dif_log lstock_dif_p

eststo clear

reg fw_cash_val_16 prog_area_f_h prog_area_m_h fem_headed fw_cash_val_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg fw_val_log_16 prog_area_f_h prog_area_m_h fem_headed  fw_val_log_07 $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg fw_cash_val_dif prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg fw_val_log_dif  prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg fw_hour_16 prog_area_f_h prog_area_m_h fem_headed fw_hour_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg fw_hr_log_16 prog_area_f_h prog_area_m_h fem_headed fw_hr_log_07 $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg fw_hour_dif  prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg fw_hr_dif_log  prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h


estout a b c d e f g h,  stats(test test_prob) 



***Differential effects -- Education of respondent

**gen treatment dummies
g prog_area_8p_edu = (educat_res>7 & prog_area==1)
g prog_area_8u_edu = (educat_res<8 & prog_area==1)

g res_over_7_edu = (educat_res>7)

***variables: fw_cash_val_16 fw_val_log_16 fw_cash_val_16 fw_val_log_16 fw_val_log_dif fw_hour_16 fw_hr_log_16 fw_hr_dif_log lstock_dif_p

eststo clear

reg fw_cash_val_16 prog_area_8p_edu prog_area_8u_edu res_over_7_edu  fw_cash_val_07 $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_val_log_16 prog_area_8p_edu prog_area_8u_edu res_over_7_edu fw_val_log_07 $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_cash_val_dif prog_area_8p_edu prog_area_8u_edu res_over_7_edu   $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_val_log_dif prog_area_8p_edu prog_area_8u_edu res_over_7_edu   $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_hour_16 prog_area_8p_edu prog_area_8u_edu res_over_7_edu fw_hour_07 $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_hr_log_16 prog_area_8p_edu prog_area_8u_edu res_over_7_edu  fw_hr_log_07 $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_hour_dif prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_hr_dif_log prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\fw_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests for edu

***variables: fw_cash_val_16 fw_val_log_16 fw_cash_val_16 fw_val_log_16 fw_val_log_dif fw_hour_16 fw_hr_log_16 fw_hr_dif_log 

eststo clear

reg fw_cash_val_16 prog_area_8p_edu prog_area_8u_edu res_over_7_edu fw_cash_val_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg fw_val_log_16 prog_area_8p_edu prog_area_8u_edu res_over_7_edu  fw_val_log_07 $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg fw_cash_val_dif  prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg fw_val_log_dif prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg fw_hour_16 prog_area_8p_edu prog_area_8u_edu res_over_7_edu fw_hour_07 $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg fw_hr_log_16 prog_area_8p_edu prog_area_8u_edu res_over_7_edu  fw_hr_log_07 $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg fw_hour_dif  prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg fw_hr_dif_log  prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

estout a b c d e f g h,  stats(test test_prob) 



***Differential effects -- Baseline Wealth

**gen treatment dummies 
xtile a_pca_07_by_z_by_z_bin =  a_pca_07_by_z , n(2)

g prog_area_asset_poor = (a_pca_07_by_z_bin==1 & prog_area==1)
g prog_area_asset_rich = (a_pca_07_by_z_bin==2 & prog_area==1)

g bl_asset_rich = (a_pca_07_by_z_bin==2)
g bl_asset_poor = (a_pca_07_by_z_bin==1)

***variables: fw_cash_val_16 fw_val_log_16 fw_cash_val_16 fw_val_log_16 fw_val_log_dif fw_hour_16 fw_hr_log_16 fw_hr_dif_log 

**examine sub-group specific differences

eststo clear

reg fw_cash_val_16 prog_area_asset_poor prog_area_asset_rich bl_asset_poor fw_cash_val_07 $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_val_log_16 prog_area_asset_poor prog_area_asset_rich bl_asset_poor fw_val_log_07 $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_cash_val_dif prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_val_log_dif prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_hour_16 prog_area_asset_poor prog_area_asset_rich bl_asset_poor fw_hour_07 $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_hr_log_16 prog_area_asset_poor prog_area_asset_rich bl_asset_poor fw_hr_log_07  $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_hour_dif prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_hr_dif_log prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\fw_wealth_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

***variables: fw_cash_val_16 fw_val_log_16 fw_cash_val_16 fw_val_log_16 fw_val_log_dif fw_hour_16 fw_hr_log_16 fw_hr_dif_log 

eststo clear

reg fw_cash_val_16 prog_area_asset_poor prog_area_asset_rich bl_asset_poor  fw_cash_val_07 $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg fw_val_log_16 prog_area_asset_poor prog_area_asset_rich bl_asset_poor fw_val_log_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg fw_cash_val_dif prog_area_asset_poor prog_area_asset_rich bl_asset_poor   $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg fw_val_log_dif prog_area_asset_poor prog_area_asset_rich bl_asset_poor   $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg fw_hour_16 prog_area_asset_poor prog_area_asset_rich bl_asset_poor fw_hour_07 $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg fw_hr_log_16 prog_area_asset_poor prog_area_asset_rich bl_asset_poor  fw_hr_log_07 $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg fw_hour_dif  prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg fw_hr_dif_log  prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

estout a b c d e f g h,  stats(test test_prob) 



***Differential effects -- Land Holding Size

**gen treatment dummies

g prog_area_land_u2 = (land_bl<2 & prog_area==1)
g prog_area_land_o2 = (land_b>=2 & prog_area==1)

g land_o2 = (land_b>=2)

***variables: fw_cash_val_16 fw_val_log_16 fw_cash_val_16 fw_val_log_16 fw_val_log_dif fw_hour_16 fw_hr_log_16 fw_hr_dif_log 

**examine sub-group specific differences

eststo clear

reg fw_cash_val_16 prog_area_land_u2 prog_area_land_o2 land_o2 fw_cash_val_07 $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_val_log_16 prog_area_land_u2 prog_area_land_o2 land_o2 fw_val_log_07  $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_cash_val_dif prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_val_log_dif prog_area_land_u2 prog_area_land_o2 land_o2 $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_hour_16 prog_area_land_u2 prog_area_land_o2 land_o2 fw_hour_07 $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_hr_log_16 prog_area_land_u2 prog_area_land_o2 land_o2 fw_hr_log_07 $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_hour_dif prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_hr_dif_log prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables_fw_land_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests for edu

***variables: fw_cash_val_16 fw_val_log_16 fw_cash_val_16 fw_val_log_16 fw_val_log_dif fw_hour_16 fw_hr_log_16 fw_hr_dif_log

eststo clear

reg fw_cash_val_16 prog_area_land_u2 prog_area_land_o2 land_o2  fw_cash_val_07 $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg fw_val_log_16 prog_area_land_u2 prog_area_land_o2 land_o2 fw_val_log_07 $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg fw_cash_val_dif prog_area_land_u2 prog_area_land_o2 land_o2 $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg fw_val_log_dif prog_area_land_u2 prog_area_land_o2 land_o2   $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg fw_hour_16 prog_area_land_u2 prog_area_land_o2 land_o2 fw_hour_07 $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg fw_hr_log_16 prog_area_land_u2 prog_area_land_o2 land_o2 fw_hr_log_07 $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg fw_hour_dif  prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg fw_hr_dif_log  prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

estout a b c d e f g h,  stats(test test_prob) 


***Differential effects -- Dairy Farmers

**gen treatment dummies

g prog_area_dar = (dar_prod==1 & prog_area==1)
g prog_area_no_dar = (dar_prod==0 & prog_area==1)

**examine sub-group specific differences

***variables: fw_cash_val_16 fw_val_log_16 fw_cash_val_16 fw_val_log_16 fw_val_log_dif fw_hour_16 fw_hr_log_16 fw_hr_dif_log 


eststo clear

reg fw_cash_val_16 prog_area_dar prog_area_no_dar dar_prod fw_cash_val_07 $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_val_log_16 prog_area_dar prog_area_no_dar dar_prod fw_val_log_07 $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_cash_val_dif prog_area_dar prog_area_no_dar dar_prod   $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_val_log_dif prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_hour_16 prog_area_dar prog_area_no_dar dar_prod fw_hour_07 $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_hr_log_16 prog_area_dar prog_area_no_dar dar_prod fw_hr_log_07 $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_hour_dif prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_hr_dif_log prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
eststo


esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\dar_fw_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

***variables: fw_cash_val_16 fw_val_log_16 fw_cash_val_16 fw_val_log_16 fw_val_log_dif fw_hour_16 fw_hr_log_16 fw_hr_dif_log 

eststo clear

reg fw_cash_val_16 prog_area_dar prog_area_no_dar dar_prod fw_cash_val_07 $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg fw_val_log_16 prog_area_dar prog_area_no_dar dar_prod fw_val_log_07 $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg fw_cash_val_dif prog_area_dar prog_area_no_dar dar_prod   $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg fw_val_log_dif prog_area_dar prog_area_no_dar dar_prod   $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg fw_hour_16 prog_area_dar prog_area_no_dar dar_prod fw_hour_07 $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg fw_hr_log_16 prog_area_dar prog_area_no_dar dar_prod fw_hr_log_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg fw_hour_dif  prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg fw_hr_dif_log  prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h


estout a b c d e f g h ,  stats(test test_prob) 



***Differential effects -- Official Position

**gen treatment dummies

g prog_area_OP = (official_role_res==1 & prog_area==1)
g prog_area_no_OP = (official_role_res==0 & prog_area==1)


**examine sub-group specific differences

***variables: fw_cash_val_16 fw_val_log_16 fw_cash_val_16 fw_val_log_16 fw_val_log_dif fw_hour_16 fw_hr_log_16 fw_hr_dif_log

eststo clear

reg fw_cash_val_16 prog_area_OP prog_area_no_OP official_role  fw_cash_val_07 $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_val_log_16 prog_area_OP prog_area_no_OP official_role fw_val_log_07  $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_cash_val_dif prog_area_OP prog_area_no_OP official_role  $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_val_log_dif prog_area_OP prog_area_no_OP official_role  $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_hour_16 prog_area_OP prog_area_no_OP official_role fw_hour_07 $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_hr_log_16 prog_area_OP prog_area_no_OP official_role fw_hr_log_07 $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_hour_dif prog_area_OP prog_area_no_OP official_role  $sl_cov i.zone  , cluster(groupid)
eststo

reg fw_hr_dif_log prog_area_OP prog_area_no_OP official_role  $sl_cov i.zone  , cluster(groupid)
eststo


esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\fw_OP_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

***variables: fw_cash_val_16 fw_val_log_16 fw_cash_val_16 fw_val_log_16 fw_val_log_dif fw_hour_16 fw_hr_log_16 fw_hr_dif_log

eststo clear

reg fw_cash_val_16 prog_area_OP prog_area_no_OP official_role fw_cash_val_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg fw_val_log_16 prog_area_OP prog_area_no_OP official_role  fw_val_log_07 $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg fw_cash_val_dif prog_area_OP prog_area_no_OP official_role   $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg fw_val_log_dif prog_area_OP prog_area_no_OP official_role   $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg fw_hour_16 prog_area_OP prog_area_no_OP official_role fw_hour_07 $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg fw_hr_log_16 prog_area_OP prog_area_no_OP official_role fw_hr_log_07 $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg fw_hour_dif  prog_area_OP prog_area_no_OP official_role  $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg fw_hr_dif_log  prog_area_OP prog_area_no_OP official_role  $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

estout a b c d e f g h,  stats(test test_prob) 


***Dairy Production

**key variables: m_yield_16_all m_yield_07_all m_yield_16_all_log m_yield_07_all_log dif_milk_y_all dif_milk_y_all_log milk_p_ch_all tree_fod_16 tree_fod_dif


eststo clear

local dar_yield avg_cow_lit_16 avg_dif_milk_y_cow avg_dif_milk_y_cow_log  cow_milk_p_ch milk_yield_change_pos milk_inc_bin tree_fod_16 tree_fod_dif

estpost tabstat `dar_yield' if dar_prod==1 & avg_dif_milk_y_cow !=. , statistics(n mean) columns(statistics)
eststo

estpost tabstat `dar_yield' if prog_area==1 & dar_prod==1 & avg_dif_milk_y_cow !=., statistics(n mean) columns(statistics)
eststo

estpost tabstat `dar_yield' if prog_area==0 & dar_prod==1 & avg_dif_milk_y_cow !=., statistics(n mean) columns(statistics)
eststo
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\dar_unaj_mean.csv", r  nogaps modelwidth(4) cells(mean(f(2))) 

**unajusted t-tests

eststo clear
local dar_yield avg_cow_lit_16 avg_dif_milk_y_cow avg_dif_milk_y_cow_log  cow_milk_p_ch milk_yield_change_pos milk_inc_bin tree_fod_16 tree_fod_dif
foreach var of local dar_yield  {
reg `var' prog_area if dar_prod==1 & avg_dif_milk_y_cow !=.  , robust
eststo
}

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\dar_unaj_ttests.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



eststo clear

local dar_yield avg_cow_lit_16 avg_dif_milk_y_cow avg_dif_milk_y_cow_log  cow_milk_p_ch milk_yield_change_pos milk_inc_bin tree_fod_16 tree_fod_dif

estpost tabstat `dar_yield'  if dar_prod==1 & avg_dif_milk_y_cow !=., statistics(n median) columns(statistics)
eststo

estpost tabstat `dar_yield' if prog_area==1 & dar_prod==1 & avg_dif_milk_y_cow !=., statistics(n median) columns(statistics)
eststo

estpost tabstat `dar_yield' if prog_area==0 & dar_prod==1 & avg_dif_milk_y_cow !=., statistics(n median) columns(statistics)
eststo
esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\dar_unaj_median.csv", r  label nogaps modelwidth(4) cells(p50 (f(2))) 

**unajusted t-tests

eststo clear
local dar_yield avg_cow_lit_16 avg_dif_milk_y_cow avg_dif_milk_y_cow_log cow_milk_p_ch milk_yield_change_pos tree_fod_16 tree_fod_dif
foreach var of local dar_yield {
qreg `var' prog_area if dar_prod==1 & avg_dif_milk_y_cow !=.
eststo
}

esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\dar_unaj_qreg.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)


gl sl_cov_dar "hh_size num_child max_edu_hh soc_07_avg _hh_loc_altitude  res_female res_head res_spo_head hh_lstock_07 head_prod elder_headed lnd_self_07_2"

***OLS with clustered standard errors

***variables: avg_cow_lit_16 avg_dif_milk_y_cow avg_dif_milk_y_cow_log  cow_milk_p_ch milk_yield_change_pos milk_inc_bin

eststo clear

probit tree_fod_16 prog_area tree_fod_07 $sl_cov_dar i.zone if dar_prod==1 & avg_dif_milk_y_cow !=., cluster(groupid)
eststo

probit tree_fod_dif prog_area  $sl_cov_dar i.zone if dar_prod==1 & avg_dif_milk_y_cow !=., cluster(groupid)
eststo

reg avg_cow_lit_16 prog_area avg_cow_lit_07 $sl_cov_dar i.zone if dar_prod==1 & avg_dif_milk_y_cow !=., cluster(groupid)
eststo

reg avg_dif_milk_y_cow prog_area $sl_cov_dar i.zone if dar_prod==1 & avg_dif_milk_y_cow !=., cluster(groupid)
eststo

reg avg_dif_milk_y_cow_log prog_area $sl_cov_dar i.zone if dar_prod==1 & avg_dif_milk_y_cow !=., cluster(groupid)
eststo

reg cow_milk_p_ch  prog_area $sl_cov_dar i.zone if dar_prod==1 & avg_dif_milk_y_cow !=., cluster(groupid)
eststo

probit milk_yield_change_pos prog_area $sl_cov_dar i.zone if dar_prod==1 & avg_dif_milk_y_cow !=., cluster(groupid)
eststo

probit milk_inc_bin  prog_area $sl_cov_dar i.zone if dar_prod==1 & avg_dif_milk_y_cow !=., cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\dar_ols.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



***IPWRA

**shortlist covariates correlated with outcome

stepwise, pr (.1): probit tree_fod_16 $all_cov samp_z_1  samp_z_3 samp_z_4 if dar_prod==1 & avg_dif_milk_y_cow !=., r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_tree_fod_16 "`X'"

stepwise, pr (.1): reg tree_fod_dif $all_cov samp_z_1  samp_z_3 samp_z_4 if dar_prod==1 & avg_dif_milk_y_cow !=., r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_tree_fod_dif "`X'"


stepwise, pr (.1): reg avg_cow_lit_16 $all_cov samp_z_1  samp_z_3 samp_z_4 if dar_prod==1 & avg_dif_milk_y_cow !=., r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_avg_cow_lit_16 "`X'"

stepwise, pr (.1): reg avg_dif_milk_y_cow $all_cov samp_z_1  samp_z_3 samp_z_4 if dar_prod==1 & avg_dif_milk_y_cow !=., r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_avg_dif_milk_y_cow "`X'"

stepwise, pr (.1): reg avg_dif_milk_y_cow_log $all_cov samp_z_1  samp_z_3 samp_z_4 if dar_prod==1 & avg_dif_milk_y_cow !=., r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_avg_dif_milk_y_cow_log "`X'"

stepwise, pr (.1): reg cow_milk_p_ch $all_cov samp_z_1  samp_z_3 samp_z_4 if dar_prod==1 & avg_dif_milk_y_cow !=., r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_cow_milk_p_ch "`X'"

stepwise, pr (.1): probit milk_yield_change_pos $all_cov samp_z_1  samp_z_3 samp_z_4 if dar_prod==1 & avg_dif_milk_y_cow !=., r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_milk_yield_change_pos "`X'"

stepwise, pr (.1): probit milk_inc_bin $all_cov samp_z_1  samp_z_3 samp_z_4 if dar_prod==1 & avg_dif_milk_y_cow !=., r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_milk_inc_bin "`X'"

eststo clear

teffects ipwra (tree_fod_dif   $cov_tree_fod_dif $sl_cov_dar i.zone) (prog_area avg_cow_lit_07 $sl_cov_dar i.zone,  probit) if dar_prod==1 & avg_dif_milk_y_cow !=., vce(r)
eststo
teffects ipwra (avg_cow_lit_16  avg_cow_lit_07 $cov_avg_cow_lit_16 $sl_cov_dar i.zone) (prog_area avg_cow_lit_07 $sl_cov_dar i.zone, probit) if dar_prod==1 & avg_dif_milk_y_cow !=., vce(r)
eststo
teffects ipwra (avg_dif_milk_y_cow $cov_avg_dif_milk_y_cow $sl_cov_dar i.zone) (prog_area  $sl_cov_dar i.zone, probit) if dar_prod==1 & avg_dif_milk_y_cow !=., vce(r)
eststo
teffects ipwra (avg_dif_milk_y_cow_log $cov_avg_dif_milk_y_cow_log $sl_cov_dar i.zone) (prog_area  $sl_cov_dar i.zone, probit) if dar_prod==1 & avg_dif_milk_y_cow !=., vce(r)
eststo
teffects ipwra (cow_milk_p_ch $cov_cow_milk_p_ch $sl_cov_dar i.zone) (prog_area  $sl_cov_dar i.zone, probit) if dar_prod==1 & avg_dif_milk_y_cow !=., vce(r)
eststo
teffects ipwra (milk_yield_change_pos $cov_milk_inc_bin $sl_cov_dar i.zone, probit) (prog_area  $sl_cov_dar i.zone , probit) if dar_prod==1 & avg_dif_milk_y_cow !=.,  vce(r)
eststo

teffects ipwra (milk_inc_bin $cov_milk_inc_bin $sl_cov_dar i.zone, probit) (prog_area  $sl_cov_dar i.zone , probit) if dar_prod==1 & avg_dif_milk_y_cow !=.,  vce(r)
eststo

esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\dar_ipwra.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



***robust regression for continuous outcomes 

eststo clear

rreg avg_cow_lit_16 prog_area avg_cow_lit_07 $sl_cov_dar i.zone if dar_prod==1 & avg_dif_milk_y_cow !=.
eststo

rreg avg_dif_milk_y_cow prog_area $sl_cov_dar i.zone if dar_prod==1 & avg_dif_milk_y_cow !=.
eststo

rreg avg_dif_milk_y_cow_log prog_area $sl_cov_dar i.zone if dar_prod==1 & avg_dif_milk_y_cow !=.
eststo

rreg cow_milk_p_ch  prog_area $sl_cov_dar i.zone if dar_prod==1 & avg_dif_milk_y_cow !=.
eststo

esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\dar_rreg.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



***PSM

***variables: avg_cow_lit_16 avg_dif_milk_y_cow avg_dif_milk_y_cow_log  cow_milk_p_ch milk_yield_change_pos milk_inc_bin
eststo clear

teffects nnmatch (tree_fod_16 tree_fod_07 $sl_cov_dar) (prog_area) if dar_prod==1 & avg_dif_milk_y_cow !=.,  ematch(zone) biasadj(num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (tree_fod_dif $sl_cov_dar) (prog_area) if dar_prod==1 & avg_dif_milk_y_cow !=.,  ematch(zone) biasadj(num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo


teffects nnmatch (avg_cow_lit_16 avg_cow_lit_07 $sl_cov_dar) (prog_area) if dar_prod==1 & avg_dif_milk_y_cow !=.,  ematch(zone) biasadj(avg_cow_lit_07 num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (avg_dif_milk_y_cow $sl_cov_dar) (prog_area) if dar_prod==1 & avg_dif_milk_y_cow !=.,  ematch(zone) biasadj(num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (avg_dif_milk_y_cow_log $sl_cov_dar) (prog_area) if dar_prod==1 & avg_dif_milk_y_cow !=.,  ematch(zone) biasadj(num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (cow_milk_p_ch $sl_cov_dar) (prog_area) if dar_prod==1 & avg_dif_milk_y_cow !=.,  ematch(zone) biasadj(num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (milk_yield_change_pos $sl_cov_dar) (prog_area) if dar_prod==1 & avg_dif_milk_y_cow !=.,  ematch(zone) biasadj(num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (milk_inc_bin  $sl_cov_dar) (prog_area) if dar_prod==1 & avg_dif_milk_y_cow !=.,  ematch(zone) biasadj(num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo



esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\dar_nn.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



eststo clear

qreg avg_cow_lit_16 prog_area avg_cow_lit_07 $sl_cov_dar i.zone if dar_prod==1 & avg_dif_milk_y_cow !=.
eststo

qreg avg_dif_milk_y_cow prog_area $sl_cov_dar i.zone if dar_prod==1 & avg_dif_milk_y_cow !=.
eststo

qreg avg_dif_milk_y_cow_log prog_area $sl_cov_dar i.zone if dar_prod==1 & avg_dif_milk_y_cow !=.
eststo

qreg cow_milk_p_ch  prog_area $sl_cov_dar i.zone if dar_prod==1 & avg_dif_milk_y_cow !=.
eststo

esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\dar_qreg.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



***2SLS

***variables: avg_cow_lit_16 avg_dif_milk_y_cow avg_dif_milk_y_cow_log  cow_milk_p_ch milk_yield_change_pos milk_inc_bin

eststo clear

ivprobit tree_fod_16 tree_fod_07 $sl_cov_dar i.zone (vi_group = prog_area tree_fod_07  $sl_cov_dar) if dar_prod==1 & avg_dif_milk_y_cow !=., vce(cluster groupid)
eststo

ivprobit tree_fod_dif $sl_cov_dar i.zone (vi_group = prog_area  $sl_cov_dar) if dar_prod==1 & avg_dif_milk_y_cow !=., vce(cluster groupid)
eststo


ivregress 2sls avg_cow_lit_16 avg_cow_lit_07 $sl_cov_dar i.zone (vi_group = prog_area avg_cow_lit_07 $sl_cov_dar) if dar_prod==1 & avg_dif_milk_y_cow !=., cluster(groupid) 
eststo

ivregress 2sls avg_dif_milk_y_cow $sl_cov_dar i.zone (vi_group = prog_area  $sl_cov_dar) if dar_prod==1 & avg_dif_milk_y_cow !=., cluster(groupid) 
eststo

ivregress 2sls avg_dif_milk_y_cow_log $sl_cov_dar i.zone (vi_group = prog_area  $sl_cov_dar) if dar_prod==1 & avg_dif_milk_y_cow !=., cluster(groupid) 
eststo

ivregress 2sls cow_milk_p_ch $sl_cov_dar i.zone (vi_group = prog_area  $sl_cov_dar) if dar_prod==1 & avg_dif_milk_y_cow !=., cluster(groupid) 
eststo

ivprobit milk_yield_change_pos $sl_cov_dar i.zone (vi_group = prog_area  $sl_cov_dar) if dar_prod==1 & avg_dif_milk_y_cow !=., vce(cluster groupid)
eststo

ivprobit milk_inc_bin $sl_cov_dar i.zone (vi_group = prog_area  $sl_cov_dar) if dar_prod==1 & avg_dif_milk_y_cow !=., vce(cluster groupid)
eststo


esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\dar_2sls.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



****Examine the extent use of tree fodder could be driving results

g tree_fod_inc = (tree_fod_dif >0)  if dar_prod==1 & avg_dif_milk_y_cow !=.

g avg_dif_milk_y_cow_p = avg_dif_milk_y_cow   if dar_prod==1 & avg_dif_milk_y_cow !=.
replace avg_dif_milk_y_cow_p = 0 if avg_dif_milk_y_cow_p <0

stepwise, pr (.1): probit tree_fod_inc res_female res_christ res_luhya res_married res_spo_out res_widow res_head res_spo_head res_healthy literate_res school_res official_role_res res_farmer res_busi res_employ r_tech_skill hh_farm_07 hh_lstock_07  hh_bus_07 hh_emp_07 irrig_07 head_prod elder_hh elder_headed fem_headed lit_adult f_lit_adult head_lit hh_on_road lnd_title_07 lnd_self_07_2 age_res educat_res hh_size num_child  y_edu_head max_edu_hh num_prod_ad land_bl pre_ce_07 a_pca_07 soc_07_avg erosion_07_avg _hh_loc_altitude hh_dist_tarma 
indeplist, local
*create global for shortlisted (sl) variables 
gl cov_sl_tree_fod_inc "`X'"

stepwise, pr (.1): reg tree_fod_dif res_female res_christ res_luhya res_married res_spo_out res_widow res_head res_spo_head res_healthy literate_res school_res official_role_res res_farmer res_busi res_employ r_tech_skill hh_farm_07 hh_lstock_07  hh_bus_07 hh_emp_07 irrig_07 head_prod elder_hh elder_headed fem_headed lit_adult f_lit_adult head_lit hh_on_road lnd_title_07 lnd_self_07_2 age_res educat_res hh_size num_child  y_edu_head max_edu_hh num_prod_ad land_bl pre_ce_07 a_pca_07 soc_07_avg erosion_07_avg _hh_loc_altitude hh_dist_tarma 
indeplist, local
*create global for shortlisted (sl) variables 
gl cov_sl_tree_fod_dif "`X'"





sem (tree_fod_inc <- prog_area ) (avg_dif_milk_y_cow <- tree_fod_inc prog_area )
estat teffects

sem (tree_fod_inc <- prog_area  $sl_cov_dar samp_z_1 samp_z_2 samp_z_3 ) (avg_dif_milk_y_cow <- tree_fod_inc prog_area $sl_cov_dar $cov_sl_tree_fod_inc samp_z_1 samp_z_2 samp_z_3 )
estat teffects

sem (tree_fod_inc <- prog_area  $sl_cov_dar samp_z_1 samp_z_2 samp_z_3 ) (avg_dif_milk_y_cow_p <- tree_fod_inc prog_area $sl_cov_dar $cov_sl_tree_fod_inc samp_z_1 samp_z_2 samp_z_3 )
estat teffects

sem (tree_fod_inc <- prog_area $sl_cov_dar samp_z_1 samp_z_2 samp_z_3) (milk_inc_bin <- tree_fod_inc prog_area $sl_cov_dar $cov_sl_tree_fod_inc samp_z_1 samp_z_2 samp_z_3)
estat teffects



drop y_tilde
gen y_tilde=.
capture program drop deboot
program define deboot, rclass
#delimit ;
reg avg_dif_milk_y_cow prog_area tree_fod_inc $cov_sl_tree_fod_inc $sl_cov i.zone if dar_prod==1 & avg_dif_milk_y_cow !=., cluster(groupid);
replace y_tilde = avg_dif_milk_y_cow - _b[tree_fod_inc]*tree_fod_inc;
reg y_tilde prog_area $sl_cov i.zone if dar_prod==1 & avg_dif_milk_y_cow !=., cluster(groupid);
return scalar deffect = _b[prog_area];
#delimit cr
end
bootstrap deffect = r(deffect), reps(500) seed(123456789): deboot




drop y_tilde
gen y_tilde=.
capture program drop deboot
program define deboot, rclass
#delimit ;
reg avg_dif_milk_y_cow prog_area tree_fod_dif $sl_cov i.zone if dar_prod==1 & avg_dif_milk_y_cow !=., cluster(groupid);
replace y_tilde = avg_dif_milk_y_cow - _b[tree_fod_dif]*tree_fod_dif;
regress y_tilde prog_area $sl_cov i.zone;
return scalar deffect = _b[prog_area];
#delimit cr
end
bootstrap deffect = r(deffect), reps(500) seed(123456789): deboot

reg avg_dif_milk_y_cow prog_area $sl_cov i.zone if dar_prod==1 & avg_dif_milk_y_cow !=., cluster(groupid)

**reg coefficient .2793559  ; **direct effect .2277498 
drop y_tilde
capture program drop deboot
program define deboot, rclass
#delimit ;
reg avg_dif_milk_y_cow prog_area tree_fod_dif $sl_cov i.zone if dar_prod==1 & avg_dif_milk_y_cow !=., cluster(groupid)
g y_tilde = avg_dif_milk_y_cow - _b[tree_fod_dif]
regress y_tilde prog_area $sl_cov i.zone
return scalar deffect = _b[prog_area];
#delimit cr
end
bootstrap deffect = r(deffect), reps(500) seed(123456789): deboot


regress onset warl gdpenl lpop lmtnest ncontig Oil nwstate instab polity2l ethfrac relfrac;
replace ytilde = onset - _b[instab]; 
reg ytilde lmtnest ncontig Oil ethfrac relfrac;
return scalar deffect = _b[ethfrac];
#delimit cr end
bootstrap deffect=r(deffect), reps(1000)
seed(12345): deboot;



***Tree and vegetative cover variables 

**key variables: trees_07_avg trees_16_avg  tree_avg_dif trees_07_fd_avg trees_16_fd_avg tree_avg_fd_dif fracveg_07_avg fracveg_16_avg fracveg_avg_dif fracveg_07_fd_avg fracveg_16_fd_avg fracveg_avg_fd_dif

eststo clear

local trees_var trees_16_avg trees_avg_dif trees_16_fd_avg trees_avg_fd_dif fracveg_16_avg fracveg_avg_dif fracveg_16_fd_avg fracveg_avg_fd_dif

estpost tabstat `trees_var' , statistics(n mean) columns(statistics)
eststo

estpost tabstat `trees_var' if prog_area==1 , statistics(n mean) columns(statistics)
eststo

estpost tabstat `trees_var' if prog_area==0  , statistics(n mean) columns(statistics)
eststo
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\trees_unaj_mean.csv", r  nogaps modelwidth(4) cells(mean(f(2))) 

**unajusted t-tests

eststo clear
local trees_var trees_16_avg trees_avg_dif trees_16_fd_avg trees_avg_fd_dif fracveg_16_avg fracveg_avg_dif fracveg_16_fd_avg fracveg_avg_fd_dif
foreach var of local trees_var  {
reg `var' prog_area , robust
eststo
}

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\trees_unaj_ttests.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



eststo clear

local trees_var trees_16_avg trees_avg_dif trees_16_fd_avg trees_avg_fd_dif fracveg_16_avg fracveg_avg_dif fracveg_16_fd_avg fracveg_avg_fd_dif

estpost tabstat `trees_var' , statistics(n median) columns(statistics)
eststo

estpost tabstat `trees_var' if prog_area==1 , statistics(n median) columns(statistics)
eststo

estpost tabstat `trees_var' if prog_area==0 , statistics(n median) columns(statistics)
eststo
esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\trees_unaj_median.csv", r  label nogaps modelwidth(4) cells(p50 (f(2))) 

**unajusted t-tests

eststo clear
local trees_var trees_16_avg trees_avg_dif trees_16_fd_avg trees_avg_fd_dif fracveg_16_avg fracveg_avg_dif fracveg_16_fd_avg fracveg_avg_fd_dif
foreach var of local trees_var {
qreg `var' prog_area 
eststo
}

esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\trees_unaj_qreg.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

gl sl_cov "res_female res_head res_spo_head r_tech_skill hh_lstock_07 hh_emp_07 elder_headed num_child max_edu_hh soc_07_avg hh_dist_tarma lnd_self_07_2"

***OLS with clustered standard errors

***variables: trees_16_avg trees_avg_dif trees_16_fd_avg trees_avg_fd_dif fracveg_16_avg fracveg_avg_dif fracveg_16_fd_avg fracveg_avg_fd_dif

eststo clear

reg trees_16_avg prog_area trees_07_avg $sl_cov i.zone , cluster(groupid)
eststo

reg trees_avg_dif prog_area $sl_cov i.zone , cluster(groupid)
eststo

reg trees_16_fd_avg prog_area trees_07_fd_avg $sl_cov i.zone , cluster(groupid)
eststo

reg trees_avg_fd_dif  prog_area $sl_cov i.zone, cluster(groupid)
eststo

reg fracveg_16_avg prog_area fracveg_07_avg $sl_cov i.zone , cluster(groupid)
eststo

reg fracveg_avg_dif prog_area $sl_cov i.zone , cluster(groupid)
eststo

reg fracveg_16_fd_avg prog_area fracveg_07_fd_avg $sl_cov i.zone , cluster(groupid)
eststo

reg fracveg_avg_fd_dif  prog_area $sl_cov i.zone, cluster(groupid)
eststo


esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\trees_ols.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



***IPWRA

***variables: trees_16_avg trees_avg_dif trees_16_fd_avg trees_avg_fd_dif fracveg_16_avg fracveg_avg_dif fracveg_16_fd_avg fracveg_avg_fd_dif

***shortlist covariates correlated with outcome

stepwise, pr (.1): reg trees_16_avg $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_trees_16_avg "`X'"

stepwise, pr (.1): reg trees_avg_dif $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_trees_avg_dif "`X'"

stepwise, pr (.1): reg trees_16_fd_avg $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_trees_16_fd_avg "`X'"

stepwise, pr (.1): reg trees_avg_fd_dif $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_trees_avg_fd_dif "`X'"

stepwise, pr (.1): reg fracveg_16_avg $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_fracveg_16_avg "`X'"

stepwise, pr (.1): reg fracveg_avg_dif $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_fracveg_avg_dif "`X'"

stepwise, pr (.1): reg fracveg_16_fd_avg $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_fracveg_16_fd_avg "`X'"

stepwise, pr (.1): reg fracveg_avg_fd_dif $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_fracveg_avg_fd_dif "`X'"

eststo clear

teffects ipwra (trees_16_avg trees_07_avg $cov_trees_16_avg $sl_cov i.zone) (prog_area trees_07_avg $sl_cov i.zone, probit), vce(r)
eststo
teffects ipwra (trees_avg_dif $cov_trees_avg_dif $sl_cov i.zone) (prog_area  $sl_cov i.zone, probit), vce(r)
eststo
teffects ipwra (trees_16_fd_avg trees_07_fd_avg $cov_trees_16_fd_avg $sl_cov i.zone) (prog_area trees_07_fd_avg $sl_cov i.zone, probit), vce(r)
eststo
teffects ipwra (trees_avg_fd_dif $cov_trees_avg_fd_dif  $sl_cov i.zone) (prog_area  $sl_cov i.zone, probit), vce(r)
eststo

teffects ipwra (fracveg_16_avg fracveg_07_avg $cov_fracveg_16_avg $sl_cov i.zone) (prog_area fracveg_07_avg $sl_cov i.zone, probit), vce(r)
eststo
teffects ipwra (fracveg_avg_dif $cov_fracveg_avg_dif $sl_cov i.zone) (prog_area  $sl_cov i.zone, probit), vce(r)
eststo
teffects ipwra (fracveg_16_fd_avg fracveg_07_fd_avg $cov_fracveg_16_fd_avg $sl_cov i.zone) (prog_area fracveg_07_fd_avg $sl_cov i.zone, probit), vce(r)
eststo
teffects ipwra (fracveg_avg_fd_dif $cov_fracveg_avg_fd_dif $sl_cov i.zone) (prog_area  $sl_cov i.zone, probit), vce(r)
eststo

esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\trees_ipwra.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



***robust regression for continuous outcomes 

eststo clear

rreg trees_16_avg prog_area trees_07_avg $sl_cov i.zone 
eststo

rreg trees_avg_dif prog_area $sl_cov i.zone 
eststo

rreg trees_16_fd_avg prog_area trees_07_fd_avg $sl_cov i.zone 
eststo

rreg trees_avg_fd_dif  prog_area $sl_cov i.zone
eststo

rreg fracveg_16_avg prog_area fracveg_07_avg $sl_cov i.zone 
eststo

rreg fracveg_avg_dif prog_area $sl_cov i.zone 
eststo

rreg fracveg_16_fd_avg prog_area fracveg_07_fd_avg $sl_cov i.zone 
eststo

rreg fracveg_avg_fd_dif  prog_area $sl_cov i.zone
eststo


esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\trees_rreg.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



***PSM

***variables: trees_16_avg trees_avg_dif trees_16_fd_avg trees_avg_fd_dif fracveg_16_avg fracveg_avg_dif fracveg_16_fd_avg fracveg_avg_fd_dif
eststo clear

teffects nnmatch (trees_16_avg trees_07_avg $sl_cov) (prog_area) ,  ematch(zone) biasadj(trees_07_avg num_child max_edu_hh trees_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (trees_avg_dif $sl_cov) (prog_area),  ematch(zone) biasadj(num_child max_edu_hh trees_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (trees_16_fd_avg $sl_cov) (prog_area) ,  ematch(zone) biasadj(trees_07_fd_avg num_child max_edu_hh trees_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (trees_avg_fd_dif $sl_cov) (prog_area) ,  ematch(zone) biasadj(num_child max_edu_hh trees_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (fracveg_16_avg fracveg_07_avg $sl_cov) (prog_area) ,  ematch(zone) biasadj(fracveg_07_avg num_child max_edu_hh fracveg_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (fracveg_avg_dif $sl_cov) (prog_area),  ematch(zone) biasadj(num_child max_edu_hh fracveg_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (fracveg_16_fd_avg $sl_cov) (prog_area) ,  ematch(zone) biasadj(fracveg_07_fd_avg num_child max_edu_hh fracveg_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (fracveg_avg_fd_dif $sl_cov) (prog_area) ,  ematch(zone) biasadj(num_child max_edu_hh fracveg_07_avg hh_dist_tarma) 
eststo


esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\trees_nn.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



eststo clear

qreg trees_16_avg prog_area trees_07_avg $sl_cov i.zone 
eststo

qreg trees_avg_dif prog_area $sl_cov i.zone 
eststo

qreg trees_16_fd_avg prog_area trees_07_fd_avg $sl_cov i.zone 
eststo

qreg trees_avg_fd_dif  prog_area $sl_cov i.zone
eststo

qreg fracveg_16_avg prog_area fracveg_07_avg $sl_cov i.zone 
eststo

qreg fracveg_avg_dif prog_area $sl_cov i.zone 
eststo

qreg fracveg_16_fd_avg prog_area fracveg_07_fd_avg $sl_cov i.zone 
eststo

qreg fracveg_avg_fd_dif  prog_area $sl_cov i.zone
eststo

esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\trees_qreg.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



***2SLS

***variables: trees_16_avg trees_avg_dif trees_16_fd_avg trees_avg_fd_dif fracveg_16_avg fracveg_avg_dif fracveg_16_fd_avg fracveg_avg_fd_dif

eststo clear

ivregress 2sls trees_16_avg trees_07_avg $sl_cov i.zone (vi_group = prog_area trees_07_avg $sl_cov), cluster(groupid) 
eststo

ivregress 2sls trees_avg_dif $sl_cov i.zone (vi_group = prog_area  $sl_cov), cluster(groupid) 
eststo

ivregress 2sls trees_16_fd_avg trees_07_fd_avg  $sl_cov i.zone (vi_group = prog_area trees_07_fd_avg $sl_cov) , cluster(groupid) 
eststo

ivregress 2sls trees_avg_fd_dif $sl_cov i.zone (vi_group = prog_area  $sl_cov), cluster(groupid) 
eststo

ivregress 2sls fracveg_16_avg fracveg_07_avg $sl_cov i.zone (vi_group = prog_area fracveg_07_avg $sl_cov), cluster(groupid) 
eststo

ivregress 2sls fracveg_avg_dif $sl_cov i.zone (vi_group = prog_area  $sl_cov), cluster(groupid) 
eststo

ivregress 2sls fracveg_16_fd_avg fracveg_07_fd_avg  $sl_cov i.zone (vi_group = prog_area fracveg_07_fd_avg $sl_cov) , cluster(groupid) 
eststo

ivregress 2sls fracveg_avg_fd_dif $sl_cov i.zone (vi_group = prog_area  $sl_cov), cluster(groupid) 
eststo

esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\trees_2sls.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



**examine zone specific differences

***variables: trees_16_avg trees_avg_dif trees_16_fd_avg trees_avg_fd_dif fracveg_16_avg fracveg_avg_dif fracveg_16_fd_avg fracveg_avg_fd_dif

eststo clear
 
reg trees_16_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa trees_07_avg $sl_cov i.zone , cluster(groupid)
eststo
reg trees_avg_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa $sl_cov i.zone , cluster(groupid)
eststo
reg trees_16_fd_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa trees_07_fd_avg $sl_cov i.zone , cluster(groupid)
eststo
reg trees_avg_fd_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa $sl_cov i.zone , cluster(groupid)
eststo
reg fracveg_16_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa fracveg_07_avg $sl_cov i.zone , cluster(groupid)
eststo
reg fracveg_avg_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa $sl_cov i.zone , cluster(groupid)
eststo
reg fracveg_16_fd_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa fracveg_07_fd_avg $sl_cov i.zone , cluster(groupid)
eststo
reg fracveg_avg_fd_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa $sl_cov i.zone , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\trees_vsz_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

***implement Wald test to assess how different coefficients are

**trees_16_avg

eststo clear

reg trees_16_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa trees_07_avg $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg trees_16_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa trees_07_avg $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg trees_16_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa trees_07_avg $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg trees_16_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa trees_07_avg $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg trees_16_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa trees_07_avg $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg trees_16_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa trees_07_avg $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 


**trees_avg_dif

eststo clear

reg trees_avg_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg trees_avg_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg trees_avg_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg trees_avg_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg trees_avg_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg trees_avg_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 



**trees_16_fd_avg

eststo clear

reg trees_16_fd_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa trees_07_fd_avg $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg trees_16_fd_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa trees_07_fd_avg $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg trees_16_fd_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa trees_07_fd_avg $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg trees_16_fd_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa trees_07_fd_avg $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg trees_16_fd_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa trees_07_fd_avg $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg trees_16_fd_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa trees_07_fd_avg $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 


**trees_avg_fd_dif

eststo clear

reg trees_avg_fd_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg trees_avg_fd_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg trees_avg_fd_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg trees_avg_fd_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg trees_avg_fd_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg trees_avg_fd_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 


**fracveg_16_avg

eststo clear

reg fracveg_16_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa fracveg_07_avg $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg fracveg_16_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa fracveg_07_avg $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg fracveg_16_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa fracveg_07_avg $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg fracveg_16_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa fracveg_07_avg $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg fracveg_16_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa fracveg_07_avg $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg fracveg_16_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa fracveg_07_avg $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 


**fracveg_avg_dif

eststo clear

reg fracveg_avg_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg fracveg_avg_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg fracveg_avg_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg fracveg_avg_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg fracveg_avg_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg fracveg_avg_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 



**fracveg_16_fd_avg

eststo clear

reg fracveg_16_fd_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa fracveg_07_fd_avg $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg fracveg_16_fd_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa fracveg_07_fd_avg $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg fracveg_16_fd_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa fracveg_07_fd_avg $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg fracveg_16_fd_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa fracveg_07_fd_avg $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg fracveg_16_fd_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa fracveg_07_fd_avg $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg fracveg_16_fd_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa fracveg_07_fd_avg $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 


**fracveg_avg_fd_dif

eststo clear

reg fracveg_avg_fd_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg fracveg_avg_fd_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg fracveg_avg_fd_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg fracveg_avg_fd_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg fracveg_avg_fd_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg fracveg_avg_fd_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 




***Differential effects -- Gender

**gen treatment dummies for female and male
g prog_area_f = (res_female==1 & prog_area==1)
g prog_area_m = (res_female==0 & prog_area==1)

***variables: trees_16_avg trees_avg_dif trees_16_fd_avg trees_avg_fd_dif fracveg_16_avg fracveg_avg_dif fracveg_16_fd_avg fracveg_avg_fd_dif

**examine gender specific differences

eststo clear

reg trees_16_avg prog_area_f prog_area_m res_female trees_07_avg  $sl_cov i.zone  , cluster(groupid)
eststo

reg trees_avg_dif prog_area_f prog_area_m res_female  $sl_cov i.zone  , cluster(groupid)
eststo

reg trees_16_fd_avg prog_area_f prog_area_m res_female trees_07_fd_avg  $sl_cov i.zone  , cluster(groupid)
eststo

reg trees_avg_fd_dif prog_area_f prog_area_m res_female  $sl_cov i.zone  , cluster(groupid)
eststo

reg fracveg_16_avg prog_area_f prog_area_m res_female fracveg_07_avg  $sl_cov i.zone  , cluster(groupid)
eststo

reg fracveg_avg_dif prog_area_f prog_area_m res_female  $sl_cov i.zone  , cluster(groupid)
eststo

reg fracveg_16_fd_avg prog_area_f prog_area_m res_female fracveg_07_fd_avg  $sl_cov i.zone  , cluster(groupid)
eststo

reg fracveg_avg_fd_dif prog_area_f prog_area_m res_female  $sl_cov i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\trees_gen_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests for gender

***variables: trees_16_avg trees_avg_dif trees_16_fd_avg trees_avg_fd_dif fracveg_16_avg fracveg_avg_dif fracveg_16_fd_avg fracveg_avg_fd_dif

eststo clear

reg trees_16_avg prog_area_f prog_area_m res_female trees_07_avg  $sl_cov i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg trees_avg_dif prog_area_f prog_area_m res_female  $sl_cov i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg trees_16_fd_avg prog_area_f prog_area_m res_female trees_07_fd_avg  $sl_cov i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg trees_avg_fd_dif  prog_area_f prog_area_m res_female  $sl_cov i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


reg fracveg_16_avg prog_area_f prog_area_m res_female fracveg_07_avg  $sl_cov i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg fracveg_avg_dif prog_area_f prog_area_m res_female  $sl_cov i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg fracveg_16_fd_avg prog_area_f prog_area_m res_female fracveg_07_fd_avg  $sl_cov i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg fracveg_avg_fd_dif  prog_area_f prog_area_m res_female  $sl_cov i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

estout a b c d e f g h,  stats(test test_prob) 




***Differential effects -- Sex of HH Head

**gen treatment dummies for female and male
g prog_area_f_h_h = (fem_headed==1 & prog_area==1)
g prog_area_m_h_h = (fem_headed==0 & prog_area==1)


eststo clear

reg trees_16_avg prog_area_f_h prog_area_m_h fem_headed trees_07_avg  $sl_cov i.zone  , cluster(groupid)
eststo

reg trees_avg_dif prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
eststo

reg trees_16_fd_avg prog_area_f_h prog_area_m_h fem_headed trees_07_fd_avg  $sl_cov i.zone  , cluster(groupid)
eststo

reg trees_avg_fd_dif prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
eststo

reg fracveg_16_avg prog_area_f_h prog_area_m_h fem_headed fracveg_07_avg  $sl_cov i.zone  , cluster(groupid)
eststo

reg fracveg_avg_dif prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
eststo

reg fracveg_16_fd_avg prog_area_f_h prog_area_m_h fem_headed fracveg_07_fd_avg  $sl_cov i.zone  , cluster(groupid)
eststo

reg fracveg_avg_fd_dif prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\trees_fhh_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

***variables: trees_16_avg trees_avg_dif trees_16_fd_avg trees_avg_fd_dif fracveg_16_avg fracveg_avg_dif fracveg_16_fd_avg fracveg_avg_fd_dif

eststo clear

reg trees_16_avg prog_area_f_h prog_area_m_h fem_headed trees_07_avg  $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg trees_avg_dif prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg trees_16_fd_avg prog_area_f_h prog_area_m_h fem_headed trees_07_fd_avg  $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg trees_avg_fd_dif  prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


reg fracveg_16_avg prog_area_f_h prog_area_m_h fem_headed fracveg_07_avg  $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg fracveg_avg_dif prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg fracveg_16_fd_avg prog_area_f_h prog_area_m_h fem_headed fracveg_07_fd_avg  $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg fracveg_avg_fd_dif  prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

estout a b c d e f g h,  stats(test test_prob) 



***Differential effects -- Education of respondent

**gen treatment dummies
g prog_area_8p_edu = (educat_res>7 & prog_area==1)
g prog_area_8u_edu = (educat_res<8 & prog_area==1)

g res_over_7_edu = (educat_res>7)


eststo clear

reg trees_16_avg prog_area_8p_edu prog_area_8u_edu res_over_7_edu trees_07_avg  $sl_cov i.zone  , cluster(groupid)
eststo

reg trees_avg_dif prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov i.zone  , cluster(groupid)
eststo

reg trees_16_fd_avg prog_area_8p_edu prog_area_8u_edu res_over_7_edu trees_07_fd_avg  $sl_cov i.zone  , cluster(groupid)
eststo

reg trees_avg_fd_dif prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov i.zone  , cluster(groupid)
eststo

reg fracveg_16_avg prog_area_8p_edu prog_area_8u_edu res_over_7_edu fracveg_07_avg  $sl_cov i.zone  , cluster(groupid)
eststo

reg fracveg_avg_dif prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov i.zone  , cluster(groupid)
eststo

reg fracveg_16_fd_avg prog_area_8p_edu prog_area_8u_edu res_over_7_edu fracveg_07_fd_avg  $sl_cov i.zone  , cluster(groupid)
eststo

reg fracveg_avg_fd_dif prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\soil_wealth_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests for edu

***variables: trees_16_avg trees_avg_dif trees_16_fd_avg trees_avg_fd_dif fracveg_16_avg fracveg_avg_dif fracveg_16_fd_avg fracveg_avg_fd_dif

eststo clear

reg trees_16_avg prog_area_8p_edu prog_area_8u_edu res_over_7_edu trees_07_avg  $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg trees_avg_dif prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg trees_16_fd_avg prog_area_8p_edu prog_area_8u_edu res_over_7_edu trees_07_fd_avg  $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg trees_avg_fd_dif  prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


reg fracveg_16_avg prog_area_8p_edu prog_area_8u_edu res_over_7_edu fracveg_07_avg  $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg fracveg_avg_dif prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg fracveg_16_fd_avg prog_area_8p_edu prog_area_8u_edu res_over_7_edu fracveg_07_fd_avg  $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg fracveg_avg_fd_dif  prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

estout a b c d e f g h,  stats(test test_prob) 



***Differential effects -- Baseline Wealth

**gen treatment dummies 

g prog_area_asset_poor = (a_pca_07_by_z_bin==1 & prog_area==1)
g prog_area_asset_rich = (a_pca_07_by_z_bin==2 & prog_area==1)

g bl_asset_rich = (a_pca_07_by_z_bin==2)
g bl_asset_poor = (a_pca_07_by_z_bin==1)

**examine sub-group specific differences

eststo clear

reg trees_16_avg prog_area_asset_poor prog_area_asset_rich bl_asset_poor trees_07_avg  $sl_cov i.zone  , cluster(groupid)
eststo

reg trees_avg_dif prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov i.zone  , cluster(groupid)
eststo

reg trees_16_fd_avg prog_area_asset_poor prog_area_asset_rich bl_asset_poor trees_07_fd_avg  $sl_cov i.zone  , cluster(groupid)
eststo

reg trees_avg_fd_dif prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov i.zone  , cluster(groupid)
eststo

reg fracveg_16_avg prog_area_asset_poor prog_area_asset_rich bl_asset_poor fracveg_07_avg  $sl_cov i.zone  , cluster(groupid)
eststo

reg fracveg_avg_dif prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov i.zone  , cluster(groupid)
eststo

reg fracveg_16_fd_avg prog_area_asset_poor prog_area_asset_rich bl_asset_poor fracveg_07_fd_avg  $sl_cov i.zone  , cluster(groupid)
eststo

reg fracveg_avg_fd_dif prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\af_ind_gen_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

***variables: trees_16_avg trees_avg_dif trees_16_fd_avg trees_avg_fd_dif fracveg_16_avg fracveg_avg_dif fracveg_16_fd_avg fracveg_avg_fd_dif

eststo clear

reg trees_16_avg prog_area_asset_poor prog_area_asset_rich bl_asset_poor trees_07_avg  $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg trees_avg_dif prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg trees_16_fd_avg prog_area_asset_poor prog_area_asset_rich bl_asset_poor trees_07_fd_avg  $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg trees_avg_fd_dif  prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


reg fracveg_16_avg prog_area_asset_poor prog_area_asset_rich bl_asset_poor fracveg_07_avg  $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg fracveg_avg_dif prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg fracveg_16_fd_avg prog_area_asset_poor prog_area_asset_rich bl_asset_poor fracveg_07_fd_avg  $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg fracveg_avg_fd_dif  prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

estout a b c d e f g h,  stats(test test_prob) 



**Differential effects -- 2016 consumption expenditure

**gen treatment dummies 
xtile sig_ce_log_bin =  sig_ce_log, n(2)

g prog_area_ce_poor = (sig_ce_log_bin==1 & prog_area==1)
g prog_area_ce_rich = (sig_ce_log_bin==2 & prog_area==1)

g ce_poor = (sig_ce_log_bin==1)

**examine sub-group specific differences

eststo clear

reg trees_16_avg prog_area_ce_poor prog_area_ce_rich ce_poor trees_07_avg  $sl_cov i.zone  , cluster(groupid)
eststo

reg trees_avg_dif prog_area_ce_poor prog_area_ce_rich ce_poor  $sl_cov i.zone  , cluster(groupid)
eststo

reg trees_16_fd_avg prog_area_ce_poor prog_area_ce_rich ce_poor trees_07_fd_avg  $sl_cov i.zone  , cluster(groupid)
eststo

reg trees_avg_fd_dif prog_area_ce_poor prog_area_ce_rich ce_poor  $sl_cov i.zone  , cluster(groupid)
eststo

reg fracveg_16_avg prog_area_ce_poor prog_area_ce_rich ce_poor fracveg_07_avg  $sl_cov i.zone  , cluster(groupid)
eststo

reg fracveg_avg_dif prog_area_ce_poor prog_area_ce_rich ce_poor  $sl_cov i.zone  , cluster(groupid)
eststo

reg fracveg_16_fd_avg prog_area_ce_poor prog_area_ce_rich ce_poor fracveg_07_fd_avg  $sl_cov i.zone  , cluster(groupid)
eststo

reg fracveg_avg_fd_dif prog_area_ce_poor prog_area_ce_rich ce_poor  $sl_cov i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\af_ind_gen_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

***variables: trees_16_avg trees_avg_dif trees_16_fd_avg trees_avg_fd_dif fracveg_16_avg fracveg_avg_dif fracveg_16_fd_avg fracveg_avg_fd_dif

eststo clear

reg trees_16_avg prog_area_ce_poor prog_area_ce_rich ce_poor trees_07_avg  $sl_cov i.zone  , cluster(groupid)
test prog_area_ce_poor = prog_area_ce_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg trees_avg_dif prog_area_ce_poor prog_area_ce_rich ce_poor  $sl_cov i.zone  , cluster(groupid)
test prog_area_ce_poor = prog_area_ce_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg trees_16_fd_avg prog_area_ce_poor prog_area_ce_rich ce_poor trees_07_fd_avg  $sl_cov i.zone  , cluster(groupid)
test prog_area_ce_poor = prog_area_ce_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg trees_avg_fd_dif  prog_area_ce_poor prog_area_ce_rich ce_poor  $sl_cov i.zone  , cluster(groupid)
test prog_area_ce_poor = prog_area_ce_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


reg fracveg_16_avg prog_area_ce_poor prog_area_ce_rich ce_poor fracveg_07_avg  $sl_cov i.zone  , cluster(groupid)
test prog_area_ce_poor = prog_area_ce_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg fracveg_avg_dif prog_area_ce_poor prog_area_ce_rich ce_poor  $sl_cov i.zone  , cluster(groupid)
test prog_area_ce_poor = prog_area_ce_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg fracveg_16_fd_avg prog_area_ce_poor prog_area_ce_rich ce_poor fracveg_07_fd_avg  $sl_cov i.zone  , cluster(groupid)
test prog_area_ce_poor = prog_area_ce_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg fracveg_avg_fd_dif  prog_area_ce_poor prog_area_ce_rich ce_poor  $sl_cov i.zone  , cluster(groupid)
test prog_area_ce_poor = prog_area_ce_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

estout a b c d e f g h,  stats(test test_prob) 




***Differential effects -- Land Holding Size

**gen treatment dummies

g prog_area_land_u2 = (land_bl<2 & prog_area==1)
g prog_area_land_o2 = (land_b>=2 & prog_area==1)

g land_o2 = (land_b>=2)

**examine sub-group specific differences

eststo clear

reg trees_16_avg prog_area_land_u2 prog_area_land_o2 land_o2 trees_07_avg  $sl_cov i.zone  , cluster(groupid)
eststo

reg trees_avg_dif prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
eststo

reg trees_16_fd_avg prog_area_land_u2 prog_area_land_o2 land_o2 trees_07_fd_avg  $sl_cov i.zone  , cluster(groupid)
eststo

reg trees_avg_fd_dif prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
eststo

reg fracveg_16_avg prog_area_land_u2 prog_area_land_o2 land_o2 fracveg_07_avg  $sl_cov i.zone  , cluster(groupid)
eststo

reg fracveg_avg_dif prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
eststo

reg fracveg_16_fd_avg prog_area_land_u2 prog_area_land_o2 land_o2 fracveg_07_fd_avg  $sl_cov i.zone  , cluster(groupid)
eststo

reg fracveg_avg_fd_dif prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\trees_lnd_size_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests for edu

***variables: trees_16_avg trees_avg_dif trees_16_fd_avg trees_avg_fd_dif fracveg_16_avg fracveg_avg_dif fracveg_16_fd_avg fracveg_avg_fd_dif

eststo clear

reg trees_16_avg prog_area_land_u2 prog_area_land_o2 land_o2 trees_07_avg  $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg trees_avg_dif prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg trees_16_fd_avg prog_area_land_u2 prog_area_land_o2 land_o2 trees_07_fd_avg  $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg trees_avg_fd_dif  prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


reg fracveg_16_avg prog_area_land_u2 prog_area_land_o2 land_o2 fracveg_07_avg  $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg fracveg_avg_dif prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg fracveg_16_fd_avg prog_area_land_u2 prog_area_land_o2 land_o2 fracveg_07_fd_avg  $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg fracveg_avg_fd_dif  prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

estout a b c d e f g h,  stats(test test_prob) 


***Differential effects -- Dairy Farmers

**gen treatment dummies

g prog_area_dar = (dar_prod==1 & prog_area==1)
g prog_area_no_dar = (dar_prod==0 & prog_area==1)

**examine sub-group specific differences

eststo clear

reg trees_16_avg prog_area_dar prog_area_no_dar dar_prod trees_07_avg  $sl_cov i.zone  , cluster(groupid)
eststo

reg trees_avg_dif prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
eststo

reg trees_16_fd_avg prog_area_dar prog_area_no_dar dar_prod trees_07_fd_avg  $sl_cov i.zone  , cluster(groupid)
eststo

reg trees_avg_fd_dif prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
eststo

reg fracveg_16_avg prog_area_dar prog_area_no_dar dar_prod fracveg_07_avg  $sl_cov i.zone  , cluster(groupid)
eststo

reg fracveg_avg_dif prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
eststo

reg fracveg_16_fd_avg prog_area_dar prog_area_no_dar dar_prod fracveg_07_fd_avg  $sl_cov i.zone  , cluster(groupid)
eststo

reg fracveg_avg_fd_dif prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\dar_trees_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

***variables: trees_16_avg trees_avg_dif trees_16_fd_avg trees_avg_fd_dif fracveg_16_avg fracveg_avg_dif fracveg_16_fd_avg fracveg_avg_fd_dif

eststo clear

reg trees_16_avg prog_area_dar prog_area_no_dar dar_prod trees_07_avg  $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg trees_avg_dif prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg trees_16_fd_avg prog_area_dar prog_area_no_dar dar_prod trees_07_fd_avg  $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg trees_avg_fd_dif  prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


reg fracveg_16_avg prog_area_dar prog_area_no_dar dar_prod fracveg_07_avg  $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg fracveg_avg_dif prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg fracveg_16_fd_avg prog_area_dar prog_area_no_dar dar_prod fracveg_07_fd_avg  $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg fracveg_avg_fd_dif  prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

estout a b c d e f g h,  stats(test test_prob) 




***Differential effects -- Official Position

**gen treatment dummies

g prog_area_OP = (official_role_res==1 & prog_area==1)
g prog_area_no_OP = (official_role_res==0 & prog_area==1)

**examine sub-group specific differences

eststo clear

reg trees_16_avg prog_area_OP prog_area_no_OP official_role trees_07_avg  $sl_cov i.zone  , cluster(groupid)
eststo

reg trees_avg_dif prog_area_OP prog_area_no_OP official_role  $sl_cov i.zone  , cluster(groupid)
eststo

reg trees_16_fd_avg prog_area_OP prog_area_no_OP official_role trees_07_fd_avg  $sl_cov i.zone  , cluster(groupid)
eststo

reg trees_avg_fd_dif prog_area_OP prog_area_no_OP official_role  $sl_cov i.zone  , cluster(groupid)
eststo

reg fracveg_16_avg prog_area_OP prog_area_no_OP official_role fracveg_07_avg  $sl_cov i.zone  , cluster(groupid)
eststo

reg fracveg_avg_dif prog_area_OP prog_area_no_OP official_role  $sl_cov i.zone  , cluster(groupid)
eststo

reg fracveg_16_fd_avg prog_area_OP prog_area_no_OP official_role fracveg_07_fd_avg  $sl_cov i.zone  , cluster(groupid)
eststo

reg fracveg_avg_fd_dif prog_area_OP prog_area_no_OP official_role  $sl_cov i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\trees_OP_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

***variables: trees_16_avg trees_avg_dif trees_16_fd_avg trees_avg_fd_dif fracveg_16_avg fracveg_avg_dif fracveg_16_fd_avg fracveg_avg_fd_dif

eststo clear

reg trees_16_avg prog_area_OP prog_area_no_OP official_role trees_07_avg  $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg trees_avg_dif prog_area_OP prog_area_no_OP official_role  $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg trees_16_fd_avg prog_area_OP prog_area_no_OP official_role trees_07_fd_avg  $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg trees_avg_fd_dif  prog_area_OP prog_area_no_OP official_role  $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


reg fracveg_16_avg prog_area_OP prog_area_no_OP official_role fracveg_07_avg  $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg fracveg_avg_dif prog_area_OP prog_area_no_OP official_role  $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg fracveg_16_fd_avg prog_area_OP prog_area_no_OP official_role fracveg_07_fd_avg  $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg fracveg_avg_fd_dif  prog_area_OP prog_area_no_OP official_role  $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

estout a b c d e f g h,  stats(test test_prob) 




***Differential effects -- Respondent parcel ownership

**gen treatment dummies

g prog_area_lnd_self = (lnd_self_07_2==1 & prog_area==1)
g prog_area_lnd_oth= (lnd_self_07_2==0 & prog_area==1)

g lnd_self = lnd_self_07_2

**examine sub-group specific differences

eststo clear

reg trees_16_avg prog_area_lnd_self prog_area_lnd_oth lnd_self trees_07_avg  $sl_cov i.zone  , cluster(groupid)
eststo

reg trees_avg_dif prog_area_lnd_self prog_area_lnd_oth lnd_self  $sl_cov i.zone  , cluster(groupid)
eststo

reg trees_16_fd_avg prog_area_lnd_self prog_area_lnd_oth lnd_self trees_07_fd_avg  $sl_cov i.zone  , cluster(groupid)
eststo

reg trees_avg_fd_dif prog_area_lnd_self prog_area_lnd_oth lnd_self  $sl_cov i.zone  , cluster(groupid)
eststo

reg fracveg_16_avg prog_area_lnd_self prog_area_lnd_oth lnd_self fracveg_07_avg  $sl_cov i.zone  , cluster(groupid)
eststo

reg fracveg_avg_dif prog_area_lnd_self prog_area_lnd_oth lnd_self  $sl_cov i.zone  , cluster(groupid)
eststo

reg fracveg_16_fd_avg prog_area_lnd_self prog_area_lnd_oth lnd_self fracveg_07_fd_avg  $sl_cov i.zone  , cluster(groupid)
eststo

reg fracveg_avg_fd_dif prog_area_lnd_self prog_area_lnd_oth lnd_self  $sl_cov i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\trees_OP_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

***variables: trees_16_avg trees_avg_dif trees_16_fd_avg trees_avg_fd_dif fracveg_16_avg fracveg_avg_dif fracveg_16_fd_avg fracveg_avg_fd_dif

eststo clear

reg trees_16_avg prog_area_lnd_self prog_area_lnd_oth lnd_self trees_07_avg  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_self = prog_area_lnd_oth
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg trees_avg_dif prog_area_lnd_self prog_area_lnd_oth lnd_self  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_self = prog_area_lnd_oth
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg trees_16_fd_avg prog_area_lnd_self prog_area_lnd_oth lnd_self trees_07_fd_avg  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_self = prog_area_lnd_oth
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg trees_avg_fd_dif  prog_area_lnd_self prog_area_lnd_oth lnd_self  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_self = prog_area_lnd_oth
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


reg fracveg_16_avg prog_area_lnd_self prog_area_lnd_oth lnd_self fracveg_07_avg  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_self = prog_area_lnd_oth
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg fracveg_avg_dif prog_area_lnd_self prog_area_lnd_oth lnd_self  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_self = prog_area_lnd_oth
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg fracveg_16_fd_avg prog_area_lnd_self prog_area_lnd_oth lnd_self fracveg_07_fd_avg  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_self = prog_area_lnd_oth
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg fracveg_avg_fd_dif  prog_area_lnd_self prog_area_lnd_oth lnd_self  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_self = prog_area_lnd_oth
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

estout a b c d e f g h,  stats(test test_prob) 


***Differential effects -- land title

**gen treatment dummies

g prog_area_lnd_tl = (lnd_title_07==1 & prog_area==1)
g prog_area_no_lnd_tl= (lnd_title_07==0 & prog_area==1)


**examine sub-group specific differences

eststo clear

reg trees_16_avg prog_area_lnd_tl prog_area_no_lnd_tl lnd_title_07 trees_07_avg  $sl_cov i.zone  , cluster(groupid)
eststo

reg trees_avg_dif prog_area_lnd_tl prog_area_no_lnd_tl lnd_title_07  $sl_cov i.zone  , cluster(groupid)
eststo

reg trees_16_fd_avg prog_area_lnd_tl prog_area_no_lnd_tl lnd_title_07 trees_07_fd_avg  $sl_cov i.zone  , cluster(groupid)
eststo

reg trees_avg_fd_dif prog_area_lnd_tl prog_area_no_lnd_tl lnd_title_07  $sl_cov i.zone  , cluster(groupid)
eststo

reg fracveg_16_avg prog_area_lnd_tl prog_area_no_lnd_tl lnd_title_07 fracveg_07_avg  $sl_cov i.zone  , cluster(groupid)
eststo

reg fracveg_avg_dif prog_area_lnd_tl prog_area_no_lnd_tl lnd_title_07  $sl_cov i.zone  , cluster(groupid)
eststo

reg fracveg_16_fd_avg prog_area_lnd_tl prog_area_no_lnd_tl lnd_title_07 fracveg_07_fd_avg  $sl_cov i.zone  , cluster(groupid)
eststo

reg fracveg_avg_fd_dif prog_area_lnd_tl prog_area_no_lnd_tl lnd_title_07  $sl_cov i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\trees_title_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

***variables: trees_16_avg trees_avg_dif trees_16_fd_avg trees_avg_fd_dif fracveg_16_avg fracveg_avg_dif fracveg_16_fd_avg fracveg_avg_fd_dif

eststo clear

reg trees_16_avg prog_area_lnd_tl prog_area_no_lnd_tl lnd_title_07 trees_07_avg  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_tl = prog_area_no_lnd_tl
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg trees_avg_dif prog_area_lnd_tl prog_area_no_lnd_tl lnd_title_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_tl = prog_area_no_lnd_tl
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg trees_16_fd_avg prog_area_lnd_tl prog_area_no_lnd_tl lnd_title_07 trees_07_fd_avg  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_tl = prog_area_no_lnd_tl
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg trees_avg_fd_dif  prog_area_lnd_tl prog_area_no_lnd_tl lnd_title_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_tl = prog_area_no_lnd_tl
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


reg fracveg_16_avg prog_area_lnd_tl prog_area_no_lnd_tl lnd_title_07 fracveg_07_avg  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_tl = prog_area_no_lnd_tl
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg fracveg_avg_dif prog_area_lnd_tl prog_area_no_lnd_tl lnd_title_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_tl = prog_area_no_lnd_tl
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg fracveg_16_fd_avg prog_area_lnd_tl prog_area_no_lnd_tl lnd_title_07 fracveg_07_fd_avg  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_tl = prog_area_no_lnd_tl
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg fracveg_avg_fd_dif  prog_area_lnd_tl prog_area_no_lnd_tl lnd_title_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_tl = prog_area_no_lnd_tl
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

estout a b c d e f g h,  stats(test test_prob) 







***Land Health Variables 

**key variables: soc_16_avg soc_avg_dif soc_16_fd_avg soc_avg_fd_dif erosion_16_avg erosion_avg_dif erosion_16_fd_avg erosion_avg_fd_dif

eststo clear

local soil_var soc_16_avg soc_avg_dif soc_16_fd_avg soc_avg_fd_dif erosion_16_avg erosion_avg_dif erosion_16_fd_avg erosion_avg_fd_dif

estpost tabstat `soil_var' , statistics(n mean) columns(statistics)
eststo

estpost tabstat `soil_var' if prog_area==1 , statistics(n mean) columns(statistics)
eststo

estpost tabstat `soil_var' if prog_area==0  , statistics(n mean) columns(statistics)
eststo
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\soil_unaj_mean.csv", r  nogaps modelwidth(4) cells(mean(f(2))) 

**unajusted t-tests

eststo clear
local soil_var soc_16_avg soc_avg_dif soc_16_fd_avg soc_avg_fd_dif erosion_16_avg erosion_avg_dif erosion_16_fd_avg erosion_avg_fd_dif
foreach var of local soil_var  {
reg `var' prog_area , robust
eststo
}

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\soil_unaj_ttests.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



eststo clear

local soil_var soc_16_avg soc_avg_dif soc_16_fd_avg soc_avg_fd_dif erosion_16_avg erosion_avg_dif erosion_16_fd_avg erosion_avg_fd_dif

estpost tabstat `soil_var' , statistics(n median) columns(statistics)
eststo

estpost tabstat `soil_var' if prog_area==1 , statistics(n median) columns(statistics)
eststo

estpost tabstat `soil_var' if prog_area==0 , statistics(n median) columns(statistics)
eststo
esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\soil_unaj_median.csv", r  label nogaps modelwidth(4) cells(p50 (f(2))) 

**unajusted t-tests

eststo clear
local soil_var soc_16_avg soc_avg_dif soc_16_fd_avg soc_avg_fd_dif erosion_16_avg erosion_avg_dif erosion_16_fd_avg erosion_avg_fd_dif
foreach var of local soil_var {
qreg `var' prog_area 
eststo
}

esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\soil_unaj_qreg.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)


gl sl_cov_soil "res_female res_head res_spo_head r_tech_skill hh_lstock_07 hh_emp_07 elder_headed num_child max_edu_hh hh_dist_tarma lnd_self_07_2"

***OLS with clustered standard errors

***variables: soc_16_avg soc_avg_dif soc_16_fd_avg soc_avg_fd_dif erosion_16_avg erosion_avg_dif erosion_16_fd_avg erosion_avg_fd_dif

eststo clear

reg soc_16_avg prog_area soc_07_avg $sl_cov_soil i.zone , cluster(groupid)
eststo

reg soc_avg_dif prog_area $sl_cov_soil i.zone , cluster(groupid)
eststo

reg soc_16_fd_avg prog_area soc_07_fd_avg $sl_cov_soil i.zone , cluster(groupid)
eststo

reg soc_avg_fd_dif  prog_area $sl_cov_soil i.zone, cluster(groupid)
eststo

reg erosion_16_avg prog_area erosion_07_avg $sl_cov_soil i.zone , cluster(groupid)
eststo

reg erosion_avg_dif prog_area $sl_cov_soil i.zone , cluster(groupid)
eststo

reg erosion_16_fd_avg prog_area erosion_07_fd_avg $sl_cov_soil i.zone , cluster(groupid)
eststo

reg erosion_avg_fd_dif  prog_area $sl_cov_soil i.zone, cluster(groupid)
eststo


esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\soil_ols.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



***IPWRA

***variables: soc_16_avg soc_avg_dif soc_16_fd_avg soc_avg_fd_dif erosion_16_avg erosion_avg_dif erosion_16_fd_avg erosion_avg_fd_dif

***shortlist covariates correlated with outcome

stepwise, pr (.1): reg soc_16_avg $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_soc_16_avg "`X'"

stepwise, pr (.1): reg soc_avg_dif $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_soc_avg_dif "`X'"

stepwise, pr (.1): reg soc_16_fd_avg $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_soc_16_fd_avg "`X'"

stepwise, pr (.1): reg soc_avg_fd_dif $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_soc_avg_fd_dif "`X'"

stepwise, pr (.1): reg erosion_16_avg $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_erosion_16_avg "`X'"

stepwise, pr (.1): reg erosion_avg_dif $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_erosion_avg_dif "`X'"

stepwise, pr (.1): reg erosion_16_fd_avg $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_erosion_16_fd_avg "`X'"

stepwise, pr (.1): reg erosion_avg_fd_dif $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_erosion_avg_fd_dif "`X'"

eststo clear

teffects ipwra (soc_16_avg soc_07_avg $cov_soc_16_avg $sl_cov_soil i.zone) (prog_area soc_07_avg $sl_cov_soil i.zone, probit), vce(r)
eststo
teffects ipwra (soc_avg_dif $cov_soc_avg_dif $sl_cov_soil i.zone) (prog_area  $sl_cov_soil i.zone, probit), vce(r)
eststo
teffects ipwra (soc_16_fd_avg soc_07_fd_avg $cov_soc_16_fd_avg $sl_cov_soil i.zone) (prog_area soc_07_fd_avg $sl_cov_soil i.zone, probit), vce(r)
eststo
teffects ipwra (soc_avg_fd_dif $cov_soc_avg_fd_dif  $sl_cov_soil i.zone) (prog_area  $sl_cov_soil i.zone, probit), vce(r)
eststo

teffects ipwra (erosion_16_avg erosion_07_avg $cov_erosion_16_avg $sl_cov_soil i.zone) (prog_area erosion_07_avg $sl_cov_soil i.zone, probit), vce(r)
eststo
teffects ipwra (erosion_avg_dif $cov_erosion_avg_dif $sl_cov_soil i.zone) (prog_area  $sl_cov_soil i.zone, probit), vce(r)
eststo
teffects ipwra (erosion_16_fd_avg erosion_07_fd_avg $cov_erosion_16_fd_avg $sl_cov_soil i.zone) (prog_area erosion_07_fd_avg $sl_cov_soil i.zone, probit), vce(r)
eststo
teffects ipwra (erosion_avg_fd_dif $cov_erosion_avg_fd_dif $sl_cov_soil i.zone) (prog_area  $sl_cov_soil i.zone, probit), vce(r)
eststo

esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\soil_ipwra.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



***robust regression for continuous outcomes 

eststo clear

rreg soc_16_avg prog_area soc_07_avg $sl_cov_soil i.zone 
eststo

rreg soc_avg_dif prog_area $sl_cov_soil i.zone 
eststo

rreg soc_16_fd_avg prog_area soc_07_fd_avg $sl_cov_soil i.zone 
eststo

rreg soc_avg_fd_dif  prog_area $sl_cov_soil i.zone
eststo

rreg erosion_16_avg prog_area erosion_07_avg $sl_cov_soil i.zone 
eststo

rreg erosion_avg_dif prog_area $sl_cov_soil i.zone 
eststo

rreg erosion_16_fd_avg prog_area erosion_07_fd_avg $sl_cov_soil i.zone 
eststo

rreg erosion_avg_fd_dif  prog_area $sl_cov_soil i.zone
eststo


esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\soil_rreg.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



***PSM

***variables: soc_16_avg soc_avg_dif soc_16_fd_avg soc_avg_fd_dif erosion_16_avg erosion_avg_dif erosion_16_fd_avg erosion_avg_fd_dif
eststo clear

teffects nnmatch (soc_16_avg soc_07_avg $sl_cov_soil) (prog_area) ,  ematch(zone) biasadj(soc_07_avg num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (soc_avg_dif $sl_cov_soil) (prog_area),  ematch(zone) biasadj(num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (soc_16_fd_avg $sl_cov_soil) (prog_area) ,  ematch(zone) biasadj(soc_07_fd_avg num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (soc_avg_fd_dif $sl_cov_soil) (prog_area) ,  ematch(zone) biasadj(num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (erosion_16_avg erosion_07_avg $sl_cov_soil) (prog_area) ,  ematch(zone) biasadj(erosion_07_avg num_child max_edu_hh erosion_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (erosion_avg_dif $sl_cov_soil) (prog_area),  ematch(zone) biasadj(num_child max_edu_hh erosion_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (erosion_16_fd_avg $sl_cov_soil) (prog_area) ,  ematch(zone) biasadj(erosion_07_fd_avg num_child max_edu_hh erosion_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (erosion_avg_fd_dif $sl_cov_soil) (prog_area) ,  ematch(zone) biasadj(num_child max_edu_hh erosion_07_avg hh_dist_tarma) 
eststo


esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\soil_nn.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



eststo clear

qreg soc_16_avg prog_area soc_07_avg $sl_cov_soil i.zone 
eststo

qreg soc_avg_dif prog_area $sl_cov_soil i.zone 
eststo

qreg soc_16_fd_avg prog_area soc_07_fd_avg $sl_cov_soil i.zone 
eststo

qreg soc_avg_fd_dif  prog_area $sl_cov_soil i.zone
eststo

qreg erosion_16_avg prog_area erosion_07_avg $sl_cov_soil i.zone 
eststo

qreg erosion_avg_dif prog_area $sl_cov_soil i.zone 
eststo

qreg erosion_16_fd_avg prog_area erosion_07_fd_avg $sl_cov_soil i.zone 
eststo

qreg erosion_avg_fd_dif  prog_area $sl_cov_soil i.zone
eststo

esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\soil_qreg.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



***2SLS

***variables: soc_16_avg soc_avg_dif soc_16_fd_avg soc_avg_fd_dif erosion_16_avg erosion_avg_dif erosion_16_fd_avg erosion_avg_fd_dif

eststo clear

ivregress 2sls soc_16_avg soc_07_avg $sl_cov_soil i.zone (vi_group = prog_area soc_07_avg $sl_cov_soil), cluster(groupid) 
eststo

ivregress 2sls soc_avg_dif $sl_cov_soil i.zone (vi_group = prog_area  $sl_cov_soil), cluster(groupid) 
eststo

ivregress 2sls soc_16_fd_avg soc_07_fd_avg  $sl_cov_soil i.zone (vi_group = prog_area soc_07_fd_avg $sl_cov_soil) , cluster(groupid) 
eststo

ivregress 2sls soc_avg_fd_dif $sl_cov_soil i.zone (vi_group = prog_area  $sl_cov_soil), cluster(groupid) 
eststo

ivregress 2sls erosion_16_avg erosion_07_avg $sl_cov_soil i.zone (vi_group = prog_area erosion_07_avg $sl_cov_soil), cluster(groupid) 
eststo

ivregress 2sls erosion_avg_dif $sl_cov_soil i.zone (vi_group = prog_area  $sl_cov_soil), cluster(groupid) 
eststo

ivregress 2sls erosion_16_fd_avg erosion_07_fd_avg  $sl_cov_soil i.zone (vi_group = prog_area erosion_07_fd_avg $sl_cov_soil) , cluster(groupid) 
eststo

ivregress 2sls erosion_avg_fd_dif $sl_cov_soil i.zone (vi_group = prog_area  $sl_cov_soil), cluster(groupid) 
eststo

esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\soil_2sls.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



**examine zone specific differences

***variables: soc_16_avg soc_avg_dif soc_16_fd_avg soc_avg_fd_dif erosion_16_avg erosion_avg_dif erosion_16_fd_avg erosion_avg_fd_dif

eststo clear
 
reg soc_16_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa soc_07_avg $sl_cov_soil i.zone , cluster(groupid)
eststo
reg soc_avg_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa $sl_cov_soil i.zone , cluster(groupid)
eststo
reg soc_16_fd_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa soc_07_fd_avg $sl_cov_soil i.zone , cluster(groupid)
eststo
reg soc_avg_fd_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa $sl_cov_soil i.zone , cluster(groupid)
eststo
reg erosion_16_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa erosion_07_avg $sl_cov_soil i.zone , cluster(groupid)
eststo
reg erosion_avg_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa $sl_cov_soil i.zone , cluster(groupid)
eststo
reg erosion_16_fd_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa erosion_07_fd_avg $sl_cov_soil i.zone , cluster(groupid)
eststo
reg erosion_avg_fd_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa $sl_cov_soil i.zone , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\soil_vsz_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

***implement Wald test to assess how different coefficients are

**soc_16_avg

eststo clear

reg soc_16_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa soc_07_avg $sl_cov_soil i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg soc_16_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa soc_07_avg $sl_cov_soil i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg soc_16_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa soc_07_avg $sl_cov_soil i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg soc_16_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa soc_07_avg $sl_cov_soil i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg soc_16_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa soc_07_avg $sl_cov_soil i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg soc_16_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa soc_07_avg $sl_cov_soil i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 


**soc_avg_dif

eststo clear

reg soc_avg_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_soil i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg soc_avg_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_soil i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg soc_avg_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_soil i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg soc_avg_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_soil i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg soc_avg_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_soil i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg soc_avg_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_soil i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 



**soc_16_fd_avg

eststo clear

reg soc_16_fd_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa soc_07_fd_avg $sl_cov_soil i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg soc_16_fd_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa soc_07_fd_avg $sl_cov_soil i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg soc_16_fd_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa soc_07_fd_avg $sl_cov_soil i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg soc_16_fd_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa soc_07_fd_avg $sl_cov_soil i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg soc_16_fd_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa soc_07_fd_avg $sl_cov_soil i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg soc_16_fd_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa soc_07_fd_avg $sl_cov_soil i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 


**soc_avg_fd_dif

eststo clear

reg soc_avg_fd_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_soil i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg soc_avg_fd_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_soil i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg soc_avg_fd_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_soil i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg soc_avg_fd_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_soil i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg soc_avg_fd_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_soil i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg soc_avg_fd_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_soil i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 


**erosion_16_avg

eststo clear

reg erosion_16_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa erosion_07_avg $sl_cov_soil i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg erosion_16_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa erosion_07_avg $sl_cov_soil i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg erosion_16_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa erosion_07_avg $sl_cov_soil i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg erosion_16_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa erosion_07_avg $sl_cov_soil i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg erosion_16_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa erosion_07_avg $sl_cov_soil i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg erosion_16_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa erosion_07_avg $sl_cov_soil i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 


**erosion_avg_dif

eststo clear

reg erosion_avg_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_soil i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg erosion_avg_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_soil i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg erosion_avg_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_soil i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg erosion_avg_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_soil i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg erosion_avg_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_soil i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg erosion_avg_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_soil i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 



**erosion_16_fd_avg

eststo clear

reg erosion_16_fd_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa erosion_07_fd_avg $sl_cov_soil i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg erosion_16_fd_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa erosion_07_fd_avg $sl_cov_soil i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg erosion_16_fd_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa erosion_07_fd_avg $sl_cov_soil i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg erosion_16_fd_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa erosion_07_fd_avg $sl_cov_soil i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg erosion_16_fd_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa erosion_07_fd_avg $sl_cov_soil i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg erosion_16_fd_avg samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa erosion_07_fd_avg $sl_cov_soil i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 


**erosion_avg_fd_dif

eststo clear

reg erosion_avg_fd_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_soil i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg erosion_avg_fd_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_soil i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg erosion_avg_fd_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_soil i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg erosion_avg_fd_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_soil i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg erosion_avg_fd_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_soil i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg erosion_avg_fd_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_soil i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 




***Differential effects -- Gender

**gen treatment dummies for female and male
g prog_area_f = (res_female==1 & prog_area==1)
g prog_area_m = (res_female==0 & prog_area==1)

***variables: soc_16_avg soc_avg_dif soc_16_fd_avg soc_avg_fd_dif erosion_16_avg erosion_avg_dif erosion_16_fd_avg erosion_avg_fd_dif

**examine gender specific differences

eststo clear

reg soc_16_avg prog_area_f prog_area_m res_female soc_07_avg  $sl_cov_soil i.zone  , cluster(groupid)
eststo

reg soc_avg_dif prog_area_f prog_area_m res_female  $sl_cov_soil i.zone  , cluster(groupid)
eststo

reg soc_16_fd_avg prog_area_f prog_area_m res_female soc_07_fd_avg  $sl_cov_fd_soil i.zone  , cluster(groupid)
eststo

reg soc_avg_fd_dif prog_area_f prog_area_m res_female  $sl_cov_soil i.zone  , cluster(groupid)
eststo

reg erosion_16_avg prog_area_f prog_area_m res_female erosion_07_avg  $sl_cov_soil i.zone  , cluster(groupid)
eststo

reg erosion_avg_dif prog_area_f prog_area_m res_female  $sl_cov_soil i.zone  , cluster(groupid)
eststo

reg erosion_16_fd_avg prog_area_f prog_area_m res_female erosion_07_fd_avg  $sl_cov_fd_soil i.zone  , cluster(groupid)
eststo

reg erosion_avg_fd_dif prog_area_f prog_area_m res_female  $sl_cov_soil i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\soil_gen_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests for gender

***variables: soc_16_avg soc_avg_dif soc_16_fd_avg soc_avg_fd_dif erosion_16_avg erosion_avg_dif erosion_16_fd_avg erosion_avg_fd_dif

eststo clear

reg soc_16_avg prog_area_f prog_area_m res_female soc_07_avg  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg soc_avg_dif prog_area_f prog_area_m res_female  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg soc_16_fd_avg prog_area_f prog_area_m res_female soc_07_fd_avg  $sl_cov_fd_soil i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg soc_avg_fd_dif  prog_area_f prog_area_m res_female  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


reg erosion_16_avg prog_area_f prog_area_m res_female erosion_07_avg  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg erosion_avg_dif prog_area_f prog_area_m res_female  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg erosion_16_fd_avg prog_area_f prog_area_m res_female erosion_07_fd_avg  $sl_cov_fd_soil i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg erosion_avg_fd_dif  prog_area_f prog_area_m res_female  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

estout a b c d e f g h,  stats(test test_prob) 




***Differential effects -- Sex of HH Head

**gen treatment dummies for female and male
g prog_area_f_h_h = (fem_headed==1 & prog_area==1)
g prog_area_m_h_h = (fem_headed==0 & prog_area==1)


eststo clear

reg soc_16_avg prog_area_f_h prog_area_m_h fem_headed soc_07_avg  $sl_cov_soil i.zone  , cluster(groupid)
eststo

reg soc_avg_dif prog_area_f_h prog_area_m_h fem_headed  $sl_cov_soil i.zone  , cluster(groupid)
eststo

reg soc_16_fd_avg prog_area_f_h prog_area_m_h fem_headed soc_07_fd_avg  $sl_cov_fd_soil i.zone  , cluster(groupid)
eststo

reg soc_avg_fd_dif prog_area_f_h prog_area_m_h fem_headed  $sl_cov_soil i.zone  , cluster(groupid)
eststo

reg erosion_16_avg prog_area_f_h prog_area_m_h fem_headed erosion_07_avg  $sl_cov_soil i.zone  , cluster(groupid)
eststo

reg erosion_avg_dif prog_area_f_h prog_area_m_h fem_headed  $sl_cov_soil i.zone  , cluster(groupid)
eststo

reg erosion_16_fd_avg prog_area_f_h prog_area_m_h fem_headed erosion_07_fd_avg  $sl_cov_fd_soil i.zone  , cluster(groupid)
eststo

reg erosion_avg_fd_dif prog_area_f_h prog_area_m_h fem_headed  $sl_cov_soil i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\soil_fhh_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

***variables: soc_16_avg soc_avg_dif soc_16_fd_avg soc_avg_fd_dif erosion_16_avg erosion_avg_dif erosion_16_fd_avg erosion_avg_fd_dif

eststo clear

reg soc_16_avg prog_area_f_h prog_area_m_h fem_headed soc_07_avg  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg soc_avg_dif prog_area_f_h prog_area_m_h fem_headed  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg soc_16_fd_avg prog_area_f_h prog_area_m_h fem_headed soc_07_fd_avg  $sl_cov_fd_soil i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg soc_avg_fd_dif  prog_area_f_h prog_area_m_h fem_headed  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


reg erosion_16_avg prog_area_f_h prog_area_m_h fem_headed erosion_07_avg  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg erosion_avg_dif prog_area_f_h prog_area_m_h fem_headed  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg erosion_16_fd_avg prog_area_f_h prog_area_m_h fem_headed erosion_07_fd_avg  $sl_cov_fd_soil i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg erosion_avg_fd_dif  prog_area_f_h prog_area_m_h fem_headed  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

estout a b c d e f g h,  stats(test test_prob) 



***Differential effects -- Education of respondent

**gen treatment dummies
g prog_area_8p_edu = (educat_res>7 & prog_area==1)
g prog_area_8u_edu = (educat_res<8 & prog_area==1)

g res_over_7_edu = (educat_res>7)


eststo clear

reg soc_16_avg prog_area_8p_edu prog_area_8u_edu res_over_7_edu soc_07_avg  $sl_cov_soil i.zone  , cluster(groupid)
eststo

reg soc_avg_dif prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov_soil i.zone  , cluster(groupid)
eststo

reg soc_16_fd_avg prog_area_8p_edu prog_area_8u_edu res_over_7_edu soc_07_fd_avg  $sl_cov_fd_soil i.zone  , cluster(groupid)
eststo

reg soc_avg_fd_dif prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov_soil i.zone  , cluster(groupid)
eststo

reg erosion_16_avg prog_area_8p_edu prog_area_8u_edu res_over_7_edu erosion_07_avg  $sl_cov_soil i.zone  , cluster(groupid)
eststo

reg erosion_avg_dif prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov_soil i.zone  , cluster(groupid)
eststo

reg erosion_16_fd_avg prog_area_8p_edu prog_area_8u_edu res_over_7_edu erosion_07_fd_avg  $sl_cov_fd_soil i.zone  , cluster(groupid)
eststo

reg erosion_avg_fd_dif prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov_soil i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\soil_wealth_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests for edu

***variables: soc_16_avg soc_avg_dif soc_16_fd_avg soc_avg_fd_dif erosion_16_avg erosion_avg_dif erosion_16_fd_avg erosion_avg_fd_dif

eststo clear

reg soc_16_avg prog_area_8p_edu prog_area_8u_edu res_over_7_edu soc_07_avg  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg soc_avg_dif prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg soc_16_fd_avg prog_area_8p_edu prog_area_8u_edu res_over_7_edu soc_07_fd_avg  $sl_cov_fd_soil i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg soc_avg_fd_dif  prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


reg erosion_16_avg prog_area_8p_edu prog_area_8u_edu res_over_7_edu erosion_07_avg  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg erosion_avg_dif prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg erosion_16_fd_avg prog_area_8p_edu prog_area_8u_edu res_over_7_edu erosion_07_fd_avg  $sl_cov_fd_soil i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg erosion_avg_fd_dif  prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

estout a b c d e f g h,  stats(test test_prob) 



***Differential effects -- Baseline Wealth

**gen treatment dummies 

xtile a_pca_07_by_z_bin =  a_pca_07_by_z , n(2)

g prog_area_asset_poor = (a_pca_07_by_z_bin==1 & prog_area==1)
g prog_area_asset_rich = (a_pca_07_by_z_bin==2 & prog_area==1)

g bl_asset_rich = (a_pca_07_by_z_bin==2)
g bl_asset_poor = (a_pca_07_by_z_bin==1)

**examine sub-group specific differences

eststo clear

reg soc_16_avg prog_area_asset_poor prog_area_asset_rich bl_asset_poor soc_07_avg  $sl_cov_soil i.zone  , cluster(groupid)
eststo

reg soc_avg_dif prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov_soil i.zone  , cluster(groupid)
eststo

reg soc_16_fd_avg prog_area_asset_poor prog_area_asset_rich bl_asset_poor soc_07_fd_avg  $sl_cov_fd_soil i.zone  , cluster(groupid)
eststo

reg soc_avg_fd_dif prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov_soil i.zone  , cluster(groupid)
eststo

reg erosion_16_avg prog_area_asset_poor prog_area_asset_rich bl_asset_poor erosion_07_avg  $sl_cov_soil i.zone  , cluster(groupid)
eststo

reg erosion_avg_dif prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov_soil i.zone  , cluster(groupid)
eststo

reg erosion_16_fd_avg prog_area_asset_poor prog_area_asset_rich bl_asset_poor erosion_07_fd_avg  $sl_cov_fd_soil i.zone  , cluster(groupid)
eststo

reg erosion_avg_fd_dif prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov_soil i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\af_ind_gen_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

***variables: soc_16_avg soc_avg_dif soc_16_fd_avg soc_avg_fd_dif erosion_16_avg erosion_avg_dif erosion_16_fd_avg erosion_avg_fd_dif

eststo clear

reg soc_16_avg prog_area_asset_poor prog_area_asset_rich bl_asset_poor soc_07_avg  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg soc_avg_dif prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg soc_16_fd_avg prog_area_asset_poor prog_area_asset_rich bl_asset_poor soc_07_fd_avg  $sl_cov_fd_soil i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg soc_avg_fd_dif  prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


reg erosion_16_avg prog_area_asset_poor prog_area_asset_rich bl_asset_poor erosion_07_avg  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg erosion_avg_dif prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg erosion_16_fd_avg prog_area_asset_poor prog_area_asset_rich bl_asset_poor erosion_07_fd_avg  $sl_cov_fd_soil i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg erosion_avg_fd_dif  prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

estout a b c d e f g h,  stats(test test_prob) 



**Differential effects -- 2016 consumption expenditure

**gen treatment dummies 
xtile sig_ce_log_bin =  sig_ce_log, n(2)

g prog_area_ce_poor = (sig_ce_log_bin==1 & prog_area==1)
g prog_area_ce_rich = (sig_ce_log_bin==2 & prog_area==1)

g ce_poor = (sig_ce_log_bin==1)

**examine sub-group specific differences

eststo clear

reg soc_16_avg prog_area_ce_poor prog_area_ce_rich ce_poor soc_07_avg  $sl_cov_soil i.zone  , cluster(groupid)
eststo

reg soc_avg_dif prog_area_ce_poor prog_area_ce_rich ce_poor  $sl_cov_soil i.zone  , cluster(groupid)
eststo

reg soc_16_fd_avg prog_area_ce_poor prog_area_ce_rich ce_poor soc_07_fd_avg  $sl_cov_fd_soil i.zone  , cluster(groupid)
eststo

reg soc_avg_fd_dif prog_area_ce_poor prog_area_ce_rich ce_poor  $sl_cov_soil i.zone  , cluster(groupid)
eststo

reg erosion_16_avg prog_area_ce_poor prog_area_ce_rich ce_poor erosion_07_avg  $sl_cov_soil i.zone  , cluster(groupid)
eststo

reg erosion_avg_dif prog_area_ce_poor prog_area_ce_rich ce_poor  $sl_cov_soil i.zone  , cluster(groupid)
eststo

reg erosion_16_fd_avg prog_area_ce_poor prog_area_ce_rich ce_poor erosion_07_fd_avg  $sl_cov_fd_soil i.zone  , cluster(groupid)
eststo

reg erosion_avg_fd_dif prog_area_ce_poor prog_area_ce_rich ce_poor  $sl_cov_soil i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\af_ind_gen_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

***variables: soc_16_avg soc_avg_dif soc_16_fd_avg soc_avg_fd_dif erosion_16_avg erosion_avg_dif erosion_16_fd_avg erosion_avg_fd_dif

eststo clear

reg soc_16_avg prog_area_ce_poor prog_area_ce_rich ce_poor soc_07_avg  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_ce_poor = prog_area_ce_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg soc_avg_dif prog_area_ce_poor prog_area_ce_rich ce_poor  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_ce_poor = prog_area_ce_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg soc_16_fd_avg prog_area_ce_poor prog_area_ce_rich ce_poor soc_07_fd_avg  $sl_cov_fd_soil i.zone  , cluster(groupid)
test prog_area_ce_poor = prog_area_ce_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg soc_avg_fd_dif  prog_area_ce_poor prog_area_ce_rich ce_poor  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_ce_poor = prog_area_ce_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


reg erosion_16_avg prog_area_ce_poor prog_area_ce_rich ce_poor erosion_07_avg  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_ce_poor = prog_area_ce_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg erosion_avg_dif prog_area_ce_poor prog_area_ce_rich ce_poor  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_ce_poor = prog_area_ce_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg erosion_16_fd_avg prog_area_ce_poor prog_area_ce_rich ce_poor erosion_07_fd_avg  $sl_cov_fd_soil i.zone  , cluster(groupid)
test prog_area_ce_poor = prog_area_ce_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg erosion_avg_fd_dif  prog_area_ce_poor prog_area_ce_rich ce_poor  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_ce_poor = prog_area_ce_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

estout a b c d e f g h,  stats(test test_prob) 




***Differential effects -- Land Holding Size

**gen treatment dummies

g prog_area_land_u2 = (land_bl<2 & prog_area==1)
g prog_area_land_o2 = (land_b>=2 & prog_area==1)

g land_o2 = (land_b>=2)

**examine sub-group specific differences

eststo clear

reg soc_16_avg prog_area_land_u2 prog_area_land_o2 land_o2 soc_07_avg  $sl_cov_soil i.zone  , cluster(groupid)
eststo

reg soc_avg_dif prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov_soil i.zone  , cluster(groupid)
eststo

reg soc_16_fd_avg prog_area_land_u2 prog_area_land_o2 land_o2 soc_07_fd_avg  $sl_cov_fd_soil i.zone  , cluster(groupid)
eststo

reg soc_avg_fd_dif prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov_soil i.zone  , cluster(groupid)
eststo

reg erosion_16_avg prog_area_land_u2 prog_area_land_o2 land_o2 erosion_07_avg  $sl_cov_soil i.zone  , cluster(groupid)
eststo

reg erosion_avg_dif prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov_soil i.zone  , cluster(groupid)
eststo

reg erosion_16_fd_avg prog_area_land_u2 prog_area_land_o2 land_o2 erosion_07_fd_avg  $sl_cov_fd_soil i.zone  , cluster(groupid)
eststo

reg erosion_avg_fd_dif prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov_soil i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\af_ind_gen_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests for edu

***variables: soc_16_avg soc_avg_dif soc_16_fd_avg soc_avg_fd_dif erosion_16_avg erosion_avg_dif erosion_16_fd_avg erosion_avg_fd_dif

eststo clear

reg soc_16_avg prog_area_land_u2 prog_area_land_o2 land_o2 soc_07_avg  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg soc_avg_dif prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg soc_16_fd_avg prog_area_land_u2 prog_area_land_o2 land_o2 soc_07_fd_avg  $sl_cov_fd_soil i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg soc_avg_fd_dif  prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


reg erosion_16_avg prog_area_land_u2 prog_area_land_o2 land_o2 erosion_07_avg  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg erosion_avg_dif prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg erosion_16_fd_avg prog_area_land_u2 prog_area_land_o2 land_o2 erosion_07_fd_avg  $sl_cov_fd_soil i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg erosion_avg_fd_dif  prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

estout a b c d e f g h,  stats(test test_prob) 


***Differential effects -- Dairy Farmers

**gen treatment dummies

g prog_area_dar = (dar_prod==1 & prog_area==1)
g prog_area_no_dar = (dar_prod==0 & prog_area==1)

**examine sub-group specific differences

eststo clear

reg soc_16_avg prog_area_dar prog_area_no_dar dar_prod soc_07_avg  $sl_cov_soil i.zone  , cluster(groupid)
eststo

reg soc_avg_dif prog_area_dar prog_area_no_dar dar_prod  $sl_cov_soil i.zone  , cluster(groupid)
eststo

reg soc_16_fd_avg prog_area_dar prog_area_no_dar dar_prod soc_07_fd_avg  $sl_cov_fd_soil i.zone  , cluster(groupid)
eststo

reg soc_avg_fd_dif prog_area_dar prog_area_no_dar dar_prod  $sl_cov_soil i.zone  , cluster(groupid)
eststo

reg erosion_16_avg prog_area_dar prog_area_no_dar dar_prod erosion_07_avg  $sl_cov_soil i.zone  , cluster(groupid)
eststo

reg erosion_avg_dif prog_area_dar prog_area_no_dar dar_prod  $sl_cov_soil i.zone  , cluster(groupid)
eststo

reg erosion_16_fd_avg prog_area_dar prog_area_no_dar dar_prod erosion_07_fd_avg  $sl_cov_fd_soil i.zone  , cluster(groupid)
eststo

reg erosion_avg_fd_dif prog_area_dar prog_area_no_dar dar_prod  $sl_cov_soil i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\dar_lh_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

***variables: soc_16_avg soc_avg_dif soc_16_fd_avg soc_avg_fd_dif erosion_16_avg erosion_avg_dif erosion_16_fd_avg erosion_avg_fd_dif

eststo clear

reg soc_16_avg prog_area_dar prog_area_no_dar dar_prod soc_07_avg  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg soc_avg_dif prog_area_dar prog_area_no_dar dar_prod  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg soc_16_fd_avg prog_area_dar prog_area_no_dar dar_prod soc_07_fd_avg  $sl_cov_fd_soil i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg soc_avg_fd_dif  prog_area_dar prog_area_no_dar dar_prod  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


reg erosion_16_avg prog_area_dar prog_area_no_dar dar_prod erosion_07_avg  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg erosion_avg_dif prog_area_dar prog_area_no_dar dar_prod  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg erosion_16_fd_avg prog_area_dar prog_area_no_dar dar_prod erosion_07_fd_avg  $sl_cov_fd_soil i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg erosion_avg_fd_dif  prog_area_dar prog_area_no_dar dar_prod  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

estout a b c d e f g h,  stats(test test_prob) 




***Differential effects -- Official Position

**gen treatment dummies

g prog_area_OP = (official_role_res==1 & prog_area==1)
g prog_area_no_OP = (official_role_res==0 & prog_area==1)

**examine sub-group specific differences


**examine sub-group specific differences

eststo clear

reg soc_16_avg prog_area_OP prog_area_no_OP official_role soc_07_avg  $sl_cov_soil i.zone  , cluster(groupid)
eststo

reg soc_avg_dif prog_area_OP prog_area_no_OP official_role  $sl_cov_soil i.zone  , cluster(groupid)
eststo

reg soc_16_fd_avg prog_area_OP prog_area_no_OP official_role soc_07_fd_avg  $sl_cov_fd_soil i.zone  , cluster(groupid)
eststo

reg soc_avg_fd_dif prog_area_OP prog_area_no_OP official_role  $sl_cov_soil i.zone  , cluster(groupid)
eststo

reg erosion_16_avg prog_area_OP prog_area_no_OP official_role erosion_07_avg  $sl_cov_soil i.zone  , cluster(groupid)
eststo

reg erosion_avg_dif prog_area_OP prog_area_no_OP official_role  $sl_cov_soil i.zone  , cluster(groupid)
eststo

reg erosion_16_fd_avg prog_area_OP prog_area_no_OP official_role erosion_07_fd_avg  $sl_cov_fd_soil i.zone  , cluster(groupid)
eststo

reg erosion_avg_fd_dif prog_area_OP prog_area_no_OP official_role  $sl_cov_soil i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\dar_lh_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

***variables: soc_16_avg soc_avg_dif soc_16_fd_avg soc_avg_fd_dif erosion_16_avg erosion_avg_dif erosion_16_fd_avg erosion_avg_fd_dif

eststo clear

reg soc_16_avg prog_area_OP prog_area_no_OP official_role soc_07_avg  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg soc_avg_dif prog_area_OP prog_area_no_OP official_role  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg soc_16_fd_avg prog_area_OP prog_area_no_OP official_role soc_07_fd_avg  $sl_cov_fd_soil i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg soc_avg_fd_dif  prog_area_OP prog_area_no_OP official_role  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


reg erosion_16_avg prog_area_OP prog_area_no_OP official_role erosion_07_avg  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg erosion_avg_dif prog_area_OP prog_area_no_OP official_role  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg erosion_16_fd_avg prog_area_OP prog_area_no_OP official_role erosion_07_fd_avg  $sl_cov_fd_soil i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg erosion_avg_fd_dif  prog_area_OP prog_area_no_OP official_role  $sl_cov_soil i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

estout a b c d e f g h,  stats(test test_prob) 




****Examine extent increases in trees could be driving for SOC

stepwise, pr (.1): reg trees_avg_dif $all_cov
indeplist, local
*create global for shortlisted (sl) variables 
gl cov_sl_trees_avg_dif "`X'"

sem (trees_avg_dif <- prog_area  $sl_cov samp_z_1 samp_z_2 samp_z_3 ) (soc_avg_dif <- trees_avg_dif prog_area $sl_cov $cov_sl_trees_avg_dif samp_z_1 samp_z_2 samp_z_3 )
estat teffects


g trees_avg_dif_p = trees_avg_dif
replace trees_avg_dif_p = 0 if  trees_avg_dif_p <0

g soc_avg_dif_p = soc_avg_dif
replace soc_avg_dif_p = 0 if  soc_avg_dif_p <0


stepwise, pr (.1): reg trees_avg_dif_p $all_cov
indeplist, local
*create global for shortlisted (sl) variables 
gl cov_sl_trees_avg_dif_p "`X'"

sem (trees_avg_dif_p <- prog_area  $sl_cov samp_z_1 samp_z_2 samp_z_3 ) (soc_avg_dif_p <- trees_avg_dif_p prog_area $sl_cov $cov_sl_trees_avg_dif_p samp_z_1 samp_z_2 samp_z_3 )
estat teffects





g trees_avg_p = (trees_avg_dif>0) if trees_avg_dif !=0

g soc_avg_p = (soc_avg_dif>2) if soc_avg_dif !=0

stepwise, pr (.1): probit trees_avg_p $all_cov
indeplist, local
*create global for shortlisted (sl) variables 
gl cov_sl_trees_avg_p "`X'"

sem (trees_avg_p <- prog_area  $sl_cov samp_z_1 samp_z_2 samp_z_3 ) (soc_avg_p <- trees_avg_p prog_area $sl_cov $cov_sl_trees_avg_p samp_z_1 samp_z_2 samp_z_3 )
estat teffects



*=====================================================================================
**Asset Measures -- PCA
*=====================================================================================

**outcome variable list: a_pca_16 a_pca_07 a_pca_16_by_z a_pca_07_by_z a_pca_p_dif_2 dif_a_pca_by_z raw_asset_gain_p house_char_dif_p home_dur_dif_p prod_asset_dif_p lstock_dif_p

****Generate raw stats

eststo clear

local a_list a_pca_16  a_pca_16_by_z  a_pca_p_dif_2 dif_a_pca_by_z raw_asset_gain_p house_char_dif_p home_dur_dif_p prod_asset_dif_p lstock_dif_p

estpost tabstat `a_list' , statistics(n mean) columns(statistics)
eststo

estpost tabstat `a_list' if prog_area==1  , statistics(n mean) columns(statistics)
eststo

estpost tabstat `a_list' if prog_area==0 , statistics(n mean) columns(statistics)
eststo
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\a_list_unaj_mean.csv", r  nogaps modelwidth(4) cells(mean(f(2))) 

**unajusted t-tests

eststo clear
local a_list a_pca_16  a_pca_16_by_z  a_pca_p_dif_2 dif_a_pca_by_z raw_asset_gain_p house_char_dif_p home_dur_dif_p prod_asset_dif_p lstock_dif_p
foreach var of local a_list {
reg `var' prog_area , robust
eststo
}

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\a_list_unaj_ttests.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



eststo clear

local a_list a_pca_16  a_pca_16_by_z  a_pca_p_dif_2 dif_a_pca_by_z raw_asset_gain_p house_char_dif_p home_dur_dif_p prod_asset_dif_p lstock_dif_p

estpost tabstat `a_list', statistics(n median) columns(statistics)
eststo

estpost tabstat `a_list' if prog_area==1, statistics(n median) columns(statistics)
eststo

estpost tabstat `a_list' if prog_area==0, statistics(n median) columns(statistics)
eststo
esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\a_list_unaj_median.csv", r  label nogaps modelwidth(4) cells(p50 (f(2))) 

**unajusted t-tests

eststo clear
local a_list a_pca_16  a_pca_16_by_z  a_pca_p_dif_2 dif_a_pca_by_z raw_asset_gain_p house_char_dif_p home_dur_dif_p prod_asset_dif_p lstock_dif_p
foreach var of local a_list {
qreg `var' prog_area
eststo
}

esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\a_list_fw_unaj_qreg.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)


gl sl_cov "res_female res_head res_spo_head r_tech_skill hh_lstock_07 hh_emp_07 elder_headed num_child max_edu_hh soc_07_avg hh_dist_tarma lnd_self_07_2"


***OLS with robust clustered standard errors

**outcome variable list: a_pca_16 a_pca_07 a_pca_16_by_z a_pca_07_by_z a_pca_p_dif_2 dif_a_pca_by_z raw_asset_gain_p house_char_dif_p home_dur_dif_p prod_asset_dif_p lstock_dif_p

gl sl_cov "res_female res_head res_spo_head r_tech_skill hh_lstock_07 hh_emp_07 elder_headed num_child max_edu_hh soc_07_avg hh_dist_tarma lnd_self_07_2"

eststo clear

reg a_pca_16 prog_area a_pca_07 $sl_cov i.zone , cluster(groupid)
eststo

reg a_pca_16_by_z prog_area a_pca_07_by_z $sl_cov i.zone , cluster(groupid)
eststo

reg a_pca_p_dif_2 prog_area   $sl_cov i.zone, cluster(groupid)
eststo

reg dif_a_pca_by_z prog_area  $sl_cov i.zone, cluster(groupid)
eststo

reg raw_asset_gain_p prog_area   $sl_cov i.zone , cluster(groupid)
eststo

reg house_char_dif_p prog_area   $sl_cov i.zone , cluster(groupid)
eststo

reg home_dur_dif_p prog_area   $sl_cov i.zone , cluster(groupid)
eststo

reg prod_asset_dif_p prog_area   $sl_cov i.zone , cluster(groupid)
eststo

reg lstock_dif_p prog_area   $sl_cov i.zone , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\assets_ols.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



***IPWRA

***Creation of Inverse Probability Weights***
stepwise, pr (.1): reg a_pca_16 $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_a_pca_16 "`X'"

stepwise, pr (.1): reg a_pca_16_by_z $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_a_pca_16_by_z "`X'"

stepwise, pr (.1): reg a_pca_p_dif_2 $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_a_pca_p_dif_2 "`X'"

stepwise, pr (.1): reg dif_a_pca_by_z $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_dif_a_pca_by_z "`X'"

stepwise, pr (.1): reg raw_asset_gain_p $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_raw_asset_gain_p "`X'"

stepwise, pr (.1): reg house_char_dif_p $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_house_char_dif_p "`X'"

stepwise, pr (.1): reg home_dur_dif_p $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_home_dur_dif_p "`X'"

stepwise, pr (.1): reg prod_asset_dif_p $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_prod_asset_dif_p "`X'"

stepwise, pr (.1): reg lstock_dif_p $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_lstock_dif_p "`X'"

eststo clear
teffects ipwra (a_pca_16 a_pca_07 $cov_a_pca_16 $sl_cov i.zone) (prog_area a_pca_07 $sl_cov i.zone, probit), vce(r)
eststo
teffects ipwra (a_pca_16_by_z a_pca_07_by_z $cov_a_pca_16_by_z $sl_cov i.zone) (prog_area a_pca_07_by_z $sl_cov i.zone, probit), vce(r)
eststo
teffects ipwra (a_pca_p_dif_2 $cov_a_pca_p_dif_2 $sl_cov i.zone) (prog_area  $sl_cov i.zone, probit), vce(r)
eststo
teffects ipwra (dif_a_pca_by_z $cov_dif_a_pca_by_z $sl_cov i.zone) (prog_area  $sl_cov i.zone, probit), vce(r)
eststo
teffects ipwra (raw_asset_gain_p $cov_raw_asset_gain_p $sl_cov i.zone) (prog_area  $sl_cov i.zone, probit), vce(r)
eststo
teffects ipwra (house_char_dif_p $cov_house_char_dif_p $sl_cov i.zone) (prog_area  $sl_cov i.zone, probit), vce(r)
eststo
teffects ipwra (home_dur_dif_p $cov_home_dur_dif_p $sl_cov i.zone) (prog_area  $sl_cov i.zone, probit), vce(r)
eststo
teffects ipwra (prod_asset_dif_p $cov_prod_asset_dif_p $sl_cov i.zone) (prog_area  $sl_cov i.zone, probit), vce(r)
eststo
teffects ipwra (lstock_dif_p $cov_lstock_dif_p $sl_cov i.zone) (prog_area  $sl_cov i.zone, probit), vce(r)
eststo

esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\assets_ipwra.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)


***robust regression for continuous outcomes 

eststo clear

rreg a_pca_16 prog_area a_pca_07 $sl_cov i.zone 
eststo

rreg a_pca_16_by_z prog_area a_pca_07_by_z $sl_cov i.zone 
eststo

rreg a_pca_p_dif_2 prog_area   $sl_cov i.zone
eststo

rreg dif_a_pca_by_z prog_area  $sl_cov i.zone
eststo

rreg raw_asset_gain_p prog_area   $sl_cov i.zone 
eststo

rreg house_char_dif_p prog_area   $sl_cov i.zone 
eststo

rreg home_dur_dif_p prog_area   $sl_cov i.zone 
eststo

rreg prod_asset_dif_p prog_area   $sl_cov i.zone 
eststo

rreg lstock_dif_p prog_area   $sl_cov i.zone 
eststo

esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\assets_rreg.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)


***NN matching

**outcome variable list: a_pca_16 a_pca_07 a_pca_16_by_z a_pca_07_by_z a_pca_p_dif_2 dif_a_pca_by_z raw_asset_gain_p house_char_dif_p home_dur_dif_p prod_asset_dif_p lstock_dif_p

eststo clear

teffects nnmatch (a_pca_16  a_pca_07 $sl_cov) (prog_area),  ematch(zone) biasadj(a_pca_07 num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (a_pca_16_by_z a_pca_07_by_z  $sl_cov) (prog_area),  ematch(zone) biasadj(a_pca_07_by_z  num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (a_pca_p_dif_2 $sl_cov) (prog_area),  ematch(zone) biasadj(num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (dif_a_pca_by_z  $sl_cov) (prog_area),  ematch(zone) biasadj( num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (raw_asset_gain_p  $sl_cov) (prog_area),  ematch(zone) biasadj(num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (house_char_dif_p  $sl_cov) (prog_area),  ematch(zone) biasadj(num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (home_dur_dif_p  $sl_cov) (prog_area),  ematch(zone) biasadj(num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (prod_asset_dif_p  $sl_cov) (prog_area),  ematch(zone) biasadj(num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (lstock_dif_p $sl_cov) (prog_area),  ematch(zone) biasadj(num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo


esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\assets_nn.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

***quantile reg

eststo clear

qreg a_pca_16 prog_area a_pca_07 $sl_cov i.zone 
eststo

qreg a_pca_16_by_z prog_area a_pca_07_by_z $sl_cov i.zone 
eststo

qreg a_pca_p_dif_2 prog_area   $sl_cov i.zone
eststo

qreg dif_a_pca_by_z prog_area  $sl_cov i.zone
eststo

qreg raw_asset_gain_p prog_area   $sl_cov i.zone 
eststo

qreg house_char_dif_p prog_area   $sl_cov i.zone 
eststo

qreg home_dur_dif_p prog_area   $sl_cov i.zone 
eststo

qreg prod_asset_dif_p prog_area   $sl_cov i.zone 
eststo

qreg lstock_dif_p prog_area   $sl_cov i.zone 
eststo

esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\assets_qreg.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



**outcome variable list: a_pca_16 a_pca_07 a_pca_16_by_z a_pca_07_by_z a_pca_p_dif_2 dif_a_pca_by_z raw_asset_gain_p house_char_dif_p home_dur_dif_p prod_asset_dif_p lstock_dif_p

***2SLS
eststo clear

ivregress 2sls a_pca_16 a_pca_07 $sl_cov i.zone (vi_group = prog_area a_pca_07 $sl_cov), cluster(groupid) 
eststo

ivregress 2sls a_pca_16_by_z a_pca_07_by_z $sl_cov i.zone (vi_group = prog_area a_pca_07_by_z $sl_cov), cluster(groupid) 
eststo

ivregress 2sls a_pca_p_dif_2  $sl_cov i.zone (vi_group = prog_area  $sl_cov), cluster(groupid) 
eststo

ivregress 2sls dif_a_pca_by_z $sl_cov i.zone (vi_group = prog_area  $sl_cov), cluster(groupid) 
eststo

ivregress 2sls raw_asset_gain_p $sl_cov i.zone (vi_group = prog_area  $sl_cov), cluster(groupid) 
eststo

ivregress 2sls house_char_dif_p $sl_cov i.zone (vi_group = prog_area  $sl_cov), cluster(groupid) 
eststo

ivregress 2sls home_dur_dif_p $sl_cov i.zone (vi_group = prog_area  $sl_cov), cluster(groupid) 
eststo

ivregress 2sls prod_asset_dif_p $sl_cov i.zone (vi_group = prog_area  $sl_cov), cluster(groupid) 
eststo

ivregress 2sls lstock_dif_p $sl_cov i.zone (vi_group = prog_area  $sl_cov), cluster(groupid) 
eststo

esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\sales_2sls.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)


**examine zone specific differences

**outcome variable list: a_pca_16 a_pca_07 a_pca_16_by_z a_pca_07_by_z a_pca_p_dif_2 dif_a_pca_by_z raw_asset_gain_p house_char_dif_p home_dur_dif_p prod_asset_dif_p lstock_dif_p

eststo clear
 
reg a_pca_16 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa a_pca_07 $sl_cov i.zone , cluster(groupid)
eststo
reg a_pca_16_by_z samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa a_pca_07_by_z $sl_cov i.zone , cluster(groupid)
eststo
reg a_pca_p_dif_2 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
eststo
reg dif_a_pca_by_z samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa $sl_cov i.zone , cluster(groupid)
eststo
reg raw_asset_gain_p samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
eststo
reg house_char_dif_p samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa $sl_cov i.zone , cluster(groupid)
eststo
reg home_dur_dif_p samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
eststo
reg prod_asset_dif_p samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa $sl_cov i.zone , cluster(groupid)
eststo
reg lstock_dif_p samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa $sl_cov i.zone , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\assets_vsz_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

***implement Wald test to assess how different coefficients are

**a_pca_16

eststo clear

reg a_pca_16 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa a_pca_07 $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg a_pca_16 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa a_pca_07 $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg a_pca_16 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa a_pca_07 $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg a_pca_16 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa a_pca_07 $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg a_pca_16 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa a_pca_07 $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg a_pca_16 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa a_pca_07 $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 


**a_pca_16_by_z

eststo clear

reg a_pca_16_by_z samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa a_pca_07_by_z $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg a_pca_16_by_z samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa a_pca_07_by_z $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg a_pca_16_by_z samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa a_pca_07_by_z $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg a_pca_16_by_z samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa a_pca_07_by_z $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg a_pca_16_by_z samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa a_pca_07_by_z $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg a_pca_16_by_z samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa a_pca_07_by_z $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 


**a_pca_p_dif_2

eststo clear

reg a_pca_p_dif_2 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg a_pca_p_dif_2 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg a_pca_p_dif_2 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg a_pca_p_dif_2 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg a_pca_p_dif_2 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg a_pca_p_dif_2 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 

**dif_a_pca_by_z 

eststo clear

reg dif_a_pca_by_z samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg dif_a_pca_by_z samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg dif_a_pca_by_z samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg dif_a_pca_by_z samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg dif_a_pca_by_z samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg dif_a_pca_by_z samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 


**raw_asset_gain_p 

eststo clear

reg raw_asset_gain_p  samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg raw_asset_gain_p  samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg raw_asset_gain_p  samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg raw_asset_gain_p  samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg raw_asset_gain_p  samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg raw_asset_gain_p  samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 


**house_char_dif_p 

eststo clear

reg house_char_dif_p   samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg house_char_dif_p   samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg house_char_dif_p   samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg house_char_dif_p   samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg house_char_dif_p   samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg house_char_dif_p   samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 

**home_dur_dif_p 

eststo clear

reg home_dur_dif_p    samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg home_dur_dif_p    samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg home_dur_dif_p    samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg home_dur_dif_p    samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg home_dur_dif_p    samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg home_dur_dif_p    samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 


**prod_asset_dif_p 

eststo clear

reg prod_asset_dif_p     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg prod_asset_dif_p     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg prod_asset_dif_p     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg prod_asset_dif_p     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg prod_asset_dif_p     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg prod_asset_dif_p     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 


**lstock_dif_p

eststo clear

reg lstock_dif_p     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg lstock_dif_p     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg lstock_dif_p     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg lstock_dif_p     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg lstock_dif_p     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg lstock_dif_p     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 




***Differential effects -- Gender

**gen treatment dummies for female and male
g prog_area_f = (res_female==1 & prog_area==1)
g prog_area_m = (res_female==0 & prog_area==1)


**outcome variable list: a_pca_16 a_pca_07 a_pca_16_by_z a_pca_07_by_z a_pca_p_dif_2 dif_a_pca_by_z raw_asset_gain_p house_char_dif_p home_dur_dif_p prod_asset_dif_p lstock_dif_p


**examine gender specific differences

eststo clear

reg a_pca_16 prog_area_f prog_area_m res_female a_pca_07  $sl_cov i.zone  , cluster(groupid)
eststo

reg a_pca_16_by_z prog_area_f prog_area_m res_female a_pca_07_by_z $sl_cov i.zone  , cluster(groupid)
eststo

reg a_pca_p_dif_2 prog_area_f prog_area_m res_female   $sl_cov i.zone  , cluster(groupid)
eststo

reg dif_a_pca_by_z prog_area_f prog_area_m res_female  $sl_cov i.zone  , cluster(groupid)
eststo

reg raw_asset_gain_p prog_area_f prog_area_m res_female   $sl_cov i.zone  , cluster(groupid)
eststo

reg house_char_dif_p prog_area_f prog_area_m res_female  $sl_cov i.zone  , cluster(groupid)
eststo

reg home_dur_dif_p prog_area_f prog_area_m res_female   $sl_cov i.zone  , cluster(groupid)
eststo

reg prod_asset_dif_p prog_area_f prog_area_m res_female  $sl_cov i.zone  , cluster(groupid)
eststo

reg lstock_dif_p prog_area_f prog_area_m res_female  $sl_cov i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\asset_gen_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests for gender

***variables: a_pca_16 a_pca_16_by_z a_pca_p_dif_2 dif_a_pca_by_z raw_asset_gain_p house_char_dif_p home_dur_dif_p prod_asset_dif_p lstock_dif_p

eststo clear

reg a_pca_16 prog_area_f prog_area_m res_female a_pca_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg a_pca_16_by_z prog_area_f prog_area_m res_female a_pca_07_by_z  $sl_cov i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg a_pca_p_dif_2 prog_area_f prog_area_m res_female $sl_cov i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg dif_a_pca_by_z  prog_area_f prog_area_m res_female  $sl_cov i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


reg raw_asset_gain_p prog_area_f prog_area_m res_female   $sl_cov i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg house_char_dif_p prog_area_f prog_area_m res_female  $sl_cov i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg home_dur_dif_p prog_area_f prog_area_m res_female   $sl_cov i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg prod_asset_dif_p  prog_area_f prog_area_m res_female  $sl_cov i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

reg lstock_dif_p  prog_area_f prog_area_m res_female  $sl_cov i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store i

estout a b c d e f g h i,  stats(test test_prob) 



eststo clear

rreg a_pca_16 prog_area_f prog_area_m res_female a_pca_07  $sl_cov i.zone  
eststo

rreg a_pca_16_by_z prog_area_f prog_area_m res_female a_pca_07_by_z $sl_cov i.zone  
eststo

rreg a_pca_p_dif_2 prog_area_f prog_area_m res_female   $sl_cov i.zone 
eststo

rreg dif_a_pca_by_z prog_area_f prog_area_m res_female  $sl_cov i.zone  
eststo

rreg raw_asset_gain_p prog_area_f prog_area_m res_female   $sl_cov i.zone  
eststo

rreg house_char_dif_p prog_area_f prog_area_m res_female  $sl_cov i.zone 
eststo

rreg home_dur_dif_p prog_area_f prog_area_m res_female   $sl_cov i.zone 
eststo

rreg prod_asset_dif_p prog_area_f prog_area_m res_female  $sl_cov i.zone  
eststo

rreg lstock_dif_p prog_area_f prog_area_m res_female  $sl_cov i.zone 
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\asset_gen_dif_effect_rreg.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)


***variables: a_pca_16 a_pca_16_by_z a_pca_p_dif_2 dif_a_pca_by_z raw_asset_gain_p house_char_dif_p home_dur_dif_p prod_asset_dif_p lstock_dif_p

eststo clear

rreg a_pca_16 prog_area_f prog_area_m res_female a_pca_07  $sl_cov i.zone  
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

rreg a_pca_16_by_z prog_area_f prog_area_m res_female a_pca_07_by_z  $sl_cov i.zone  
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

rreg a_pca_p_dif_2 prog_area_f prog_area_m res_female $sl_cov i.zone  
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

rreg dif_a_pca_by_z  prog_area_f prog_area_m res_female  $sl_cov i.zone  
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


rreg raw_asset_gain_p prog_area_f prog_area_m res_female   $sl_cov i.zone 
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

rreg house_char_dif_p prog_area_f prog_area_m res_female  $sl_cov i.zone  
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

rreg home_dur_dif_p prog_area_f prog_area_m res_female   $sl_cov i.zone  
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

rreg prod_asset_dif_p  prog_area_f prog_area_m res_female  $sl_cov i.zone  
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

rreg lstock_dif_p  prog_area_f prog_area_m res_female  $sl_cov i.zone  
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store i

estout a b c d e f g h i,  stats(test test_prob) 





***Differential effects -- Sex of HH Head

**gen treatment dummies for female and male
g prog_area_f_h_h = (fem_headed==1 & prog_area==1)
g prog_area_m_h_h = (fem_headed==0 & prog_area==1)


eststo clear

reg a_pca_16 prog_area_f_h prog_area_m_h fem_headed a_pca_07  $sl_cov i.zone  , cluster(groupid)
eststo

reg a_pca_16_by_z prog_area_f_h prog_area_m_h fem_headed a_pca_07_by_z $sl_cov i.zone  , cluster(groupid)
eststo

reg a_pca_p_dif_2 prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
eststo

reg dif_a_pca_by_z prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
eststo

reg raw_asset_gain_p prog_area_f_h prog_area_m_h fem_headed   $sl_cov i.zone  , cluster(groupid)
eststo

reg house_char_dif_p prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
eststo

reg home_dur_dif_p prog_area_f_h prog_area_m_h fem_headed   $sl_cov i.zone  , cluster(groupid)
eststo

reg prod_asset_dif_p prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
eststo

reg lstock_dif_p prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
eststo


esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\assets_fhh_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

***variables: a_pca_16 a_pca_16_by_z a_pca_p_dif_2 dif_a_pca_by_z raw_asset_gain_p house_char_dif_p home_dur_dif_p prod_asset_dif_p lstock_dif_p

eststo clear

reg a_pca_16 prog_area_f_h prog_area_m_h fem_headed a_pca_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg a_pca_16_by_z prog_area_f_h prog_area_m_h fem_headed a_pca_07_by_z  $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg a_pca_p_dif_2 prog_area_f_h prog_area_m_h fem_headed   $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg dif_a_pca_by_z  prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


reg raw_asset_gain_p prog_area_f_h prog_area_m_h fem_headed   $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg house_char_dif_p prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg home_dur_dif_p prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg prod_asset_dif_p  prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

reg lstock_dif_p prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store i

estout a b c d e f g h i,  stats(test test_prob) 



***Differential effects -- Education of respondent

**gen treatment dummies
g prog_area_8p_edu = (educat_res>7 & prog_area==1)
g prog_area_8u_edu = (educat_res<8 & prog_area==1)

g res_over_7_edu = (educat_res>7)


eststo clear

reg a_pca_16 prog_area_8p_edu prog_area_8u_edu res_over_7_edu a_pca_07  $sl_cov i.zone  , cluster(groupid)
eststo

reg a_pca_16_by_z prog_area_8p_edu prog_area_8u_edu res_over_7_edu a_pca_07_by_z $sl_cov i.zone  , cluster(groupid)
eststo

reg a_pca_p_dif_2 prog_area_8p_edu prog_area_8u_edu res_over_7_edu   $sl_cov i.zone  , cluster(groupid)
eststo

reg dif_a_pca_by_z prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov i.zone  , cluster(groupid)
eststo

reg raw_asset_gain_p prog_area_8p_edu prog_area_8u_edu res_over_7_edu   $sl_cov i.zone  , cluster(groupid)
eststo

reg house_char_dif_p prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov i.zone  , cluster(groupid)
eststo

reg home_dur_dif_p prog_area_8p_edu prog_area_8u_edu res_over_7_edu   $sl_cov i.zone  , cluster(groupid)
eststo

reg prod_asset_dif_p prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov i.zone  , cluster(groupid)
eststo

reg prod_asset_dif_p prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\assets_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests for edu

***variables: a_pca_16 a_pca_16_by_z a_pca_p_dif_2 dif_a_pca_by_z raw_asset_gain_p house_char_dif_p home_dur_dif_p prod_asset_dif_p lstock_dif_p

eststo clear

reg a_pca_16 prog_area_8p_edu prog_area_8u_edu res_over_7_edu a_pca_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg a_pca_16_by_z prog_area_8p_edu prog_area_8u_edu res_over_7_edu a_pca_07_by_z  $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg a_pca_p_dif_2 prog_area_8p_edu prog_area_8u_edu res_over_7_edu   $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg dif_a_pca_by_z  prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


reg raw_asset_gain_p prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg house_char_dif_p prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg home_dur_dif_p prog_area_8p_edu prog_area_8u_edu res_over_7_edu   $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg prod_asset_dif_p  prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

reg lstock_dif_p  prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store i

estout a b c d e f g h i,  stats(test test_prob) 



***Differential effects -- Baseline Wealth

**gen treatment dummies 
xtile a_pca_07_by_z_bin =  a_pca_07_by_z , n(2)

g prog_area_asset_poor = (a_pca_07_by_z_bin==1 & prog_area==1)
g prog_area_asset_rich = (a_pca_07_by_z_bin==2 & prog_area==1)

g bl_asset_rich = (a_pca_07_by_z_bin==2)
g bl_asset_poor = (a_pca_07_by_z_bin==1)
**examine sub-group specific differences

eststo clear

reg a_pca_16 prog_area_asset_poor prog_area_asset_rich bl_asset_poor a_pca_07  $sl_cov i.zone  , cluster(groupid)
eststo

reg a_pca_16_by_z prog_area_asset_poor prog_area_asset_rich bl_asset_poor a_pca_07_by_z  $sl_cov i.zone  , cluster(groupid)
eststo

reg a_pca_p_dif_2 prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov i.zone  , cluster(groupid)
eststo

reg dif_a_pca_by_z prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov i.zone  , cluster(groupid)
eststo

reg raw_asset_gain_p prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov i.zone  , cluster(groupid)
eststo

reg house_char_dif_p prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov i.zone  , cluster(groupid)
eststo

reg home_dur_dif_p prog_area_asset_poor prog_area_asset_rich bl_asset_poor   $sl_cov i.zone  , cluster(groupid)
eststo

reg prod_asset_dif_p prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov i.zone  , cluster(groupid)
eststo

reg prod_asset_dif_p prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov i.zone  , cluster(groupid)
eststo

reg lstock_dif_p prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\asset_wealth_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

***variables: a_pca_16 a_pca_16_by_z a_pca_p_dif_2 dif_a_pca_by_z raw_asset_gain_p house_char_dif_p home_dur_dif_p prod_asset_dif_p lstock_dif_p

eststo clear

reg a_pca_16 prog_area_asset_poor prog_area_asset_rich bl_asset_poor a_pca_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg a_pca_16_by_z prog_area_asset_poor prog_area_asset_rich bl_asset_poor a_pca_07_by_z  $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg a_pca_p_dif_2 prog_area_asset_poor prog_area_asset_rich bl_asset_poor   $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg dif_a_pca_by_z  prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


reg raw_asset_gain_p prog_area_asset_poor prog_area_asset_rich bl_asset_poor   $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg house_char_dif_p prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg home_dur_dif_p prog_area_asset_poor prog_area_asset_rich bl_asset_poor   $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg prod_asset_dif_p  prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

reg lstock_dif_p  prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store i

estout a b c d e f g h i,  stats(test test_prob) 



***Differential effects -- Land Holding Size

**gen treatment dummies

g prog_area_land_u2 = (land_bl<2 & prog_area==1)
g prog_area_land_o2 = (land_b>=2 & prog_area==1)

g land_o2 = (land_b>=2)

**examine sub-group specific differences

eststo clear

reg a_pca_16 prog_area_land_u2 prog_area_land_o2 land_o2 a_pca_07  $sl_cov i.zone  , cluster(groupid)
eststo

reg a_pca_16_by_z prog_area_land_u2 prog_area_land_o2 land_o2 a_pca_07_by_z  $sl_cov i.zone  , cluster(groupid)
eststo

reg a_pca_p_dif_2 prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
eststo

reg dif_a_pca_by_z prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
eststo

reg raw_asset_gain_p prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
eststo

reg house_char_dif_p prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
eststo

reg home_dur_dif_p prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
eststo

reg prod_asset_dif_p prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
eststo

reg lstock_dif_p prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\ls_land_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests for edu

***variables: a_pca_16 a_pca_16_by_z a_pca_p_dif_2 dif_a_pca_by_z raw_asset_gain_p house_char_dif_p home_dur_dif_p prod_asset_dif_p

eststo clear

reg a_pca_16 prog_area_land_u2 prog_area_land_o2 land_o2 a_pca_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg a_pca_16_by_z prog_area_land_u2 prog_area_land_o2 land_o2 a_pca_07_by_z $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg a_pca_p_dif_2 prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg dif_a_pca_by_z  prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


reg raw_asset_gain_p prog_area_land_u2 prog_area_land_o2 land_o2   $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg house_char_dif_p prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg home_dur_dif_p prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg prod_asset_dif_p  prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

reg lstock_dif_p  prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store i

estout a b c d e f g h i,  stats(test test_prob) 


***Differential effects -- Dairy Farmers

**gen treatment dummies

g prog_area_dar = (dar_prod==1 & prog_area==1)
g prog_area_no_dar = (dar_prod==0 & prog_area==1)

**examine sub-group specific differences

eststo clear

reg a_pca_16 prog_area_dar prog_area_no_dar dar_prod a_pca_07  $sl_cov i.zone  , cluster(groupid)
eststo

reg a_pca_16_by_z prog_area_dar prog_area_no_dar dar_prod a_pca_07_by_z $sl_cov i.zone  , cluster(groupid)
eststo

reg a_pca_p_dif_2 prog_area_dar prog_area_no_dar dar_prod   $sl_cov i.zone  , cluster(groupid)
eststo

reg dif_a_pca_by_z prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
eststo

reg raw_asset_gain_p prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
eststo

reg house_char_dif_p prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
eststo

reg home_dur_dif_p prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
eststo

reg prod_asset_dif_p prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
eststo

reg lstock_dif_p prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\dar_asset_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

***variables: a_pca_16 a_pca_16_by_z a_pca_p_dif_2 dif_a_pca_by_z raw_asset_gain_p house_char_dif_p home_dur_dif_p prod_asset_dif_p lstock_dif_p

eststo clear

reg a_pca_16 prog_area_dar prog_area_no_dar dar_prod a_pca_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg a_pca_16_by_z prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg a_pca_p_dif_2 prog_area_dar prog_area_no_dar dar_prod   $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg dif_a_pca_by_z  prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


reg raw_asset_gain_p prog_area_dar prog_area_no_dar dar_prod   $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg house_char_dif_p prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg home_dur_dif_p prog_area_dar prog_area_no_dar dar_prod   $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg prod_asset_dif_p  prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

reg lstock_dif_p  prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store i

estout a b c d e f g h i,  stats(test test_prob) 



***Differential effects -- Official Position

**gen treatment dummies

g prog_area_OP = (official_role_res==1 & prog_area==1)
g prog_area_no_OP = (official_role_res==0 & prog_area==1)


**examine sub-group specific differences

eststo clear

reg a_pca_16 prog_area_OP prog_area_no_OP official_role a_pca_07  $sl_cov i.zone  , cluster(groupid)
eststo

reg a_pca_16_by_z prog_area_OP prog_area_no_OP official_role a_pca_07_by_z  $sl_cov i.zone  , cluster(groupid)
eststo

reg a_pca_p_dif_2 prog_area_OP prog_area_no_OP official_role   $sl_cov i.zone  , cluster(groupid)
eststo

reg dif_a_pca_by_z prog_area_OP prog_area_no_OP official_role  $sl_cov i.zone  , cluster(groupid)
eststo

reg raw_asset_gain_p prog_area_OP prog_area_no_OP official_role   $sl_cov i.zone  , cluster(groupid)
eststo

reg house_char_dif_p prog_area_OP prog_area_no_OP official_role  $sl_cov i.zone  , cluster(groupid)
eststo

reg home_dur_dif_p prog_area_OP prog_area_no_OP official_role  $sl_cov i.zone  , cluster(groupid)
eststo

reg prod_asset_dif_p prog_area_OP prog_area_no_OP official_role  $sl_cov i.zone  , cluster(groupid)
eststo

reg lstock_dif_p prog_area_OP prog_area_no_OP official_role  $sl_cov i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\asset_OP_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

***variables: a_pca_16 a_pca_16_by_z a_pca_p_dif_2 dif_a_pca_by_z raw_asset_gain_p house_char_dif_p home_dur_dif_p prod_asset_dif_p lstock_dif_p

eststo clear

reg a_pca_16 prog_area_OP prog_area_no_OP official_role a_pca_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg a_pca_16_by_z prog_area_OP prog_area_no_OP official_role a_pca_07_by_z  $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg a_pca_p_dif_2 prog_area_OP prog_area_no_OP official_role   $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg dif_a_pca_by_z  prog_area_OP prog_area_no_OP official_role  $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


reg raw_asset_gain_p prog_area_OP prog_area_no_OP official_role   $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg house_char_dif_p prog_area_OP prog_area_no_OP official_role  $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg home_dur_dif_p prog_area_OP prog_area_no_OP official_role  $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg prod_asset_dif_p  prog_area_OP prog_area_no_OP official_role  $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

reg lstock_dif_p  prog_area_OP prog_area_no_OP official_role  $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store i

estout a b c d e f g h i,  stats(test test_prob) 



***Differential effects -- land ownership (not with spouse; formal or unformal title)

**gen treatment dummies

g prog_area_lnd_self = (lnd_self_07_2==1 & prog_area==1)
g prog_area_lnd_oth= (lnd_self_07_2==0 & prog_area==1)

g lnd_self = lnd_self_07_2
**examine sub-group specific differences

eststo clear

reg a_pca_16 prog_area_lnd_self prog_area_lnd_oth lnd_self a_pca_07  $sl_cov i.zone  , cluster(groupid)
eststo

reg a_pca_16_by_z prog_area_lnd_self prog_area_lnd_oth lnd_self a_pca_07_by_z  $sl_cov i.zone  , cluster(groupid)
eststo

reg a_pca_p_dif_2 prog_area_lnd_self prog_area_lnd_oth lnd_self   $sl_cov i.zone  , cluster(groupid)
eststo

reg dif_a_pca_by_z prog_area_lnd_self prog_area_lnd_oth lnd_self  $sl_cov i.zone  , cluster(groupid)
eststo

reg raw_asset_gain_p prog_area_lnd_self prog_area_lnd_oth lnd_self   $sl_cov i.zone  , cluster(groupid)
eststo

reg house_char_dif_p prog_area_lnd_self prog_area_lnd_oth lnd_self  $sl_cov i.zone  , cluster(groupid)
eststo

reg home_dur_dif_p prog_area_lnd_self prog_area_lnd_oth lnd_self  $sl_cov i.zone  , cluster(groupid)
eststo

reg prod_asset_dif_p prog_area_lnd_self prog_area_lnd_oth lnd_self  $sl_cov i.zone  , cluster(groupid)
eststo

reg lstock_dif_p prog_area_lnd_self prog_area_lnd_oth lnd_self  $sl_cov i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\asset_land_own_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

***variables: a_pca_16 a_pca_16_by_z a_pca_p_dif_2 dif_a_pca_by_z raw_asset_gain_p house_char_dif_p home_dur_dif_p prod_asset_dif_p lstock_dif_p

eststo clear

reg a_pca_16 prog_area_lnd_self prog_area_lnd_oth lnd_self a_pca_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_self = prog_area_lnd_oth
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg a_pca_16_by_z prog_area_lnd_self prog_area_lnd_oth lnd_self a_pca_07_by_z  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_self = prog_area_lnd_oth
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg a_pca_p_dif_2 prog_area_lnd_self prog_area_lnd_oth lnd_self   $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_self = prog_area_lnd_oth
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg dif_a_pca_by_z  prog_area_lnd_self prog_area_lnd_oth lnd_self  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_self = prog_area_lnd_oth
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


reg raw_asset_gain_p prog_area_lnd_self prog_area_lnd_oth lnd_self   $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_self = prog_area_lnd_oth
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg house_char_dif_p prog_area_lnd_self prog_area_lnd_oth lnd_self  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_self = prog_area_lnd_oth
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg home_dur_dif_p prog_area_lnd_self prog_area_lnd_oth lnd_self  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_self = prog_area_lnd_oth
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg prod_asset_dif_p  prog_area_lnd_self prog_area_lnd_oth lnd_self  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_self = prog_area_lnd_oth
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

reg lstock_dif_p  prog_area_lnd_self prog_area_lnd_oth lnd_self  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_self = prog_area_lnd_oth
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store i

estout a b c d e f h i,  stats(test test_prob) 


eststo clear

rreg a_pca_16 prog_area_lnd_self prog_area_lnd_oth lnd_self a_pca_07  $sl_cov i.zone 
eststo

rreg a_pca_16_by_z prog_area_lnd_self prog_area_lnd_oth lnd_self a_pca_07_by_z  $sl_cov i.zone 
eststo

rreg a_pca_p_dif_2 prog_area_lnd_self prog_area_lnd_oth lnd_self   $sl_cov i.zone  
eststo

rreg dif_a_pca_by_z prog_area_lnd_self prog_area_lnd_oth lnd_self  $sl_cov i.zone 
eststo

rreg raw_asset_gain_p prog_area_lnd_self prog_area_lnd_oth lnd_self   $sl_cov i.zone 
eststo

rreg house_char_dif_p prog_area_lnd_self prog_area_lnd_oth lnd_self  $sl_cov i.zone  
eststo

rreg home_dur_dif_p prog_area_lnd_self prog_area_lnd_oth lnd_self  $sl_cov i.zone  
eststo

rreg prod_asset_dif_p prog_area_lnd_self prog_area_lnd_oth lnd_self  $sl_cov i.zone  
eststo

rreg lstock_dif_p prog_area_lnd_self prog_area_lnd_oth lnd_self  $sl_cov i.zone  
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\asset_land_own_dif_effect_rreg.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



eststo clear

qreg a_pca_16 prog_area_lnd_self prog_area_lnd_oth lnd_self a_pca_07  $sl_cov i.zone 
eststo

qreg a_pca_16_by_z prog_area_lnd_self prog_area_lnd_oth lnd_self a_pca_07_by_z  $sl_cov i.zone 
eststo

qreg a_pca_p_dif_2 prog_area_lnd_self prog_area_lnd_oth lnd_self   $sl_cov i.zone  
eststo

qreg dif_a_pca_by_z prog_area_lnd_self prog_area_lnd_oth lnd_self  $sl_cov i.zone 
eststo

qreg raw_asset_gain_p prog_area_lnd_self prog_area_lnd_oth lnd_self   $sl_cov i.zone 
eststo

qreg house_char_dif_p prog_area_lnd_self prog_area_lnd_oth lnd_self  $sl_cov i.zone  
eststo

qreg home_dur_dif_p prog_area_lnd_self prog_area_lnd_oth lnd_self  $sl_cov i.zone  
eststo

qreg prod_asset_dif_p prog_area_lnd_self prog_area_lnd_oth lnd_self  $sl_cov i.zone  
eststo

qreg lstock_dif_p prog_area_lnd_self prog_area_lnd_oth lnd_self  $sl_cov i.zone  
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\asset_land_own_dif_effect_qreg.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)






***Differential effects -- land ownership (formal or unformal title with or without spouse)

**gen treatment dummies

g prog_area_lnd_hh = (lnd_self_07==1 & prog_area==1)
g prog_area_lnd_n_hh= (lnd_self_07==0 & prog_area==1)


**examine sub-group specific differences

eststo clear

reg a_pca_16 prog_area_lnd_hh prog_area_lnd_n_hh lnd_self_07 a_pca_07  $sl_cov i.zone  , cluster(groupid)
eststo

reg a_pca_16_by_z prog_area_lnd_hh prog_area_lnd_n_hh lnd_self_07 a_pca_07_by_z  $sl_cov i.zone  , cluster(groupid)
eststo

reg a_pca_p_dif_2 prog_area_lnd_hh prog_area_lnd_n_hh lnd_self_07   $sl_cov i.zone  , cluster(groupid)
eststo

reg dif_a_pca_by_z prog_area_lnd_hh prog_area_lnd_n_hh lnd_self_07  $sl_cov i.zone  , cluster(groupid)
eststo

reg raw_asset_gain_p prog_area_lnd_hh prog_area_lnd_n_hh lnd_self_07   $sl_cov i.zone  , cluster(groupid)
eststo

reg house_char_dif_p prog_area_lnd_hh prog_area_lnd_n_hh lnd_self_07  $sl_cov i.zone  , cluster(groupid)
eststo

reg home_dur_dif_p prog_area_lnd_hh prog_area_lnd_n_hh lnd_self_07  $sl_cov i.zone  , cluster(groupid)
eststo

reg prod_asset_dif_p prog_area_lnd_hh prog_area_lnd_n_hh lnd_self_07  $sl_cov i.zone  , cluster(groupid)
eststo

reg lstock_dif_p prog_area_lnd_hh prog_area_lnd_n_hh lnd_self_07  $sl_cov i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\asset_land_own_dif_effect_with spouse.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

***variables: a_pca_16 a_pca_16_by_z a_pca_p_dif_2 dif_a_pca_by_z raw_asset_gain_p house_char_dif_p home_dur_dif_p prod_asset_dif_p lstock_dif_p

eststo clear

reg a_pca_16 prog_area_lnd_hh prog_area_lnd_n_hh lnd_self_07 a_pca_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_hh = prog_area_lnd_n_hh
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg a_pca_16_by_z prog_area_lnd_hh prog_area_lnd_n_hh lnd_self_07 a_pca_07_by_z  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_hh = prog_area_lnd_n_hh
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg a_pca_p_dif_2 prog_area_lnd_hh prog_area_lnd_n_hh lnd_self_07   $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_hh = prog_area_lnd_n_hh
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg dif_a_pca_by_z  prog_area_lnd_hh prog_area_lnd_n_hh lnd_self_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_hh = prog_area_lnd_n_hh
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


reg raw_asset_gain_p prog_area_lnd_hh prog_area_lnd_n_hh lnd_self_07   $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_hh = prog_area_lnd_n_hh
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg house_char_dif_p prog_area_lnd_hh prog_area_lnd_n_hh lnd_self_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_hh = prog_area_lnd_n_hh
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg home_dur_dif_p prog_area_lnd_hh prog_area_lnd_n_hh lnd_self_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_hh = prog_area_lnd_n_hh
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg prod_asset_dif_p  prog_area_lnd_hh prog_area_lnd_n_hh lnd_self_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_hh = prog_area_lnd_n_hh
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

reg lstock_dif_p  prog_area_lnd_hh prog_area_lnd_n_hh lnd_self_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_hh = prog_area_lnd_n_hh
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store i

estout a b c d e f g i,  stats(test test_prob) 






***Differential effects -- land ownership formal title

**gen treatment dummies

g prog_area_lnd_tl = (lnd_title_07==1 & prog_area==1)
g prog_area_no_ln_tl= (lnd_title_07==0 & prog_area==1)


**examine sub-group specific differences

eststo clear

reg a_pca_16 prog_area_lnd_tl prog_area_no_ln_tl lnd_title_07 a_pca_07  $sl_cov i.zone  , cluster(groupid)
eststo

reg a_pca_16_by_z prog_area_lnd_tl prog_area_no_ln_tl lnd_title_07 a_pca_07_by_z  $sl_cov i.zone  , cluster(groupid)
eststo

reg a_pca_p_dif_2 prog_area_lnd_tl prog_area_no_ln_tl lnd_title_07   $sl_cov i.zone  , cluster(groupid)
eststo

reg dif_a_pca_by_z prog_area_lnd_tl prog_area_no_ln_tl lnd_title_07  $sl_cov i.zone  , cluster(groupid)
eststo

reg raw_asset_gain_p prog_area_lnd_tl prog_area_no_ln_tl lnd_title_07   $sl_cov i.zone  , cluster(groupid)
eststo

reg house_char_dif_p prog_area_lnd_tl prog_area_no_ln_tl lnd_title_07  $sl_cov i.zone  , cluster(groupid)
eststo

reg home_dur_dif_p prog_area_lnd_tl prog_area_no_ln_tl lnd_title_07  $sl_cov i.zone  , cluster(groupid)
eststo

reg prod_asset_dif_p prog_area_lnd_tl prog_area_no_ln_tl lnd_title_07  $sl_cov i.zone  , cluster(groupid)
eststo

reg lstock_dif_p prog_area_lnd_tl prog_area_no_ln_tl lnd_title_07  $sl_cov i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\asset_land_title_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

***variables: a_pca_16 a_pca_16_by_z a_pca_p_dif_2 dif_a_pca_by_z raw_asset_gain_p house_char_dif_p home_dur_dif_p prod_asset_dif_p lstock_dif_p

eststo clear

reg a_pca_16 prog_area_lnd_tl prog_area_no_ln_tl lnd_title a_pca_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_tl = prog_area_no_ln_tl
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg a_pca_16_by_z prog_area_lnd_tl prog_area_no_ln_tl lnd_title a_pca_07_by_z  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_tl = prog_area_no_ln_tl
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg a_pca_p_dif_2 prog_area_lnd_tl prog_area_no_ln_tl lnd_title   $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_tl = prog_area_no_ln_tl
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg dif_a_pca_by_z  prog_area_lnd_tl prog_area_no_ln_tl lnd_title  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_tl = prog_area_no_ln_tl
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


reg raw_asset_gain_p prog_area_lnd_tl prog_area_no_ln_tl lnd_title   $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_tl = prog_area_no_ln_tl
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg house_char_dif_p prog_area_lnd_tl prog_area_no_ln_tl lnd_title  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_tl = prog_area_no_ln_tl
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg home_dur_dif_p prog_area_lnd_tl prog_area_no_ln_tl lnd_title  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_tl = prog_area_no_ln_tl
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg prod_asset_dif_p  prog_area_lnd_tl prog_area_no_ln_tl lnd_title  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_tl = prog_area_no_ln_tl
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

reg lstock_dif_p  prog_area_lnd_tl prog_area_no_ln_tl lnd_title  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_tl = prog_area_no_ln_tl
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store i

estout a b c d e f g i,  stats(test test_prob) 



*=====================================================================================
**Consumption Expenditure Measures
*=====================================================================================

**outcome variable list: sig_ce a_pca_07_by_z sig_ce_log pre_ce_pc_07 pre_ce_log_pc_07 pre_ce_pc_16  pre_ce_log_pc_16 dif_pre_ce_pc dif_pre_ce_log_pc

****Generate raw stats

eststo clear

local ce_var sig_ce  sig_ce_log sig_ce  sig_ce_log  pre_ce_pc_16  pre_ce_log_pc_16 dif_pre_ce_pc dif_pre_ce_log_pc

estpost tabstat `ce_var' , statistics(n mean) columns(statistics)
eststo

estpost tabstat `ce_var' if prog_area==1  , statistics(n mean) columns(statistics)
eststo

estpost tabstat `ce_var' if prog_area==0 , statistics(n mean) columns(statistics)
eststo
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\ce_var_unaj_mean.csv", r  nogaps modelwidth(4) cells(mean(f(2))) 

**unajusted t-tests

eststo clear
local ce_var sig_ce  sig_ce_log sig_ce  sig_ce_log  pre_ce_pc_16  pre_ce_log_pc_16 dif_pre_ce_pc dif_pre_ce_log_pc
foreach var of local ce_var {
reg `var' prog_area , robust
eststo
}

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\ce_var_unaj_ttests.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



eststo clear

local ce_var sig_ce  sig_ce_log sig_ce  sig_ce_log  pre_ce_pc_16  pre_ce_log_pc_16 dif_pre_ce_pc dif_pre_ce_log_pc

estpost tabstat `ce_var', statistics(n median) columns(statistics)
eststo

estpost tabstat `ce_var' if prog_area==1, statistics(n median) columns(statistics)
eststo

estpost tabstat `ce_var' if prog_area==0, statistics(n median) columns(statistics)
eststo
esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\ce_var_unaj_median.csv", r  label nogaps modelwidth(4) cells(p50 (f(2))) 

**unajusted t-tests

eststo clear
local ce_var sig_ce  sig_ce_log sig_ce  sig_ce_log  pre_ce_pc_16  pre_ce_log_pc_16 dif_pre_ce_pc dif_pre_ce_log_pc
foreach var of local ce_var {
qreg `var' prog_area
eststo
}

esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\ce_var_unaj_qreg.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



***OLS with robust clustered standard errors

**outcome variable list: sig_ce a_pca_07_by_z sig_ce_log pre_ce_pc_07 pre_ce_log_pc_07 pre_ce_pc_16  pre_ce_log_pc_16 dif_pre_ce_pc dif_pre_ce_log_pc

gl sl_cov "res_female res_head res_spo_head r_tech_skill hh_lstock_07 hh_emp_07 elder_headed num_child max_edu_hh soc_07_avg hh_dist_tarma lnd_self_07_2"

eststo clear

reg sig_ce prog_area  $sl_cov i.zone , cluster(groupid)
eststo

reg sig_ce_log prog_area  $sl_cov i.zone , cluster(groupid)
eststo

reg sig_ce prog_area pre_ce_pc_07  $sl_cov i.zone, cluster(groupid)
eststo

reg sig_ce_log prog_area  pre_ce_log_pc_07 $sl_cov i.zone, cluster(groupid)
eststo

reg pre_ce_pc_16 prog_area pre_ce_pc_07  $sl_cov i.zone , cluster(groupid)
eststo

reg pre_ce_log_pc_16 prog_area pre_ce_log_pc_07  $sl_cov i.zone , cluster(groupid)
eststo

reg dif_pre_ce_pc prog_area   $sl_cov i.zone , cluster(groupid)
eststo

reg dif_pre_ce_log_pc prog_area   $sl_cov i.zone , cluster(groupid)
eststo


esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\ce_ols.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



***IPWRA
**shortlist covariaes correlated with outcome

stepwise, pr (.1): reg sig_ce $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_sig_ce "`X'"

stepwise, pr (.1): reg sig_ce_log $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_sig_ce_log "`X'"

stepwise, pr (.1): reg pre_ce_pc_16 $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_pre_ce_pc_16 "`X'"

stepwise, pr (.1): reg pre_ce_log_pc_16 $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_pre_ce_log_pc_16 "`X'"

stepwise, pr (.1): reg dif_pre_ce_pc $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_dif_pre_ce_pc "`X'"

stepwise, pr (.1): reg dif_pre_ce_log_pc $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_dif_pre_ce_log_pc "`X'"


eststo clear
teffects ipwra (sig_ce $cov_sig_ce  $sl_cov i.zone) (prog_area  $sl_cov i.zone, probit), vce(r)
eststo
teffects ipwra (sig_ce_log $cov_sig_ce_log  $sl_cov i.zone) (prog_area  $sl_cov i.zone, probit), vce(r)
eststo
teffects ipwra (sig_ce pre_ce_pc_07 $cov_sig_ce $sl_cov i.zone) (prog_area pre_ce_pc_07 $sl_cov i.zone, probit), vce(r)
eststo
teffects ipwra (sig_ce_log pre_ce_pc_07 $cov_sig_ce_log $sl_cov i.zone) (prog_area pre_ce_pc_07 $sl_cov i.zone, probit), vce(r)
eststo
teffects ipwra (pre_ce_pc_16 pre_ce_pc_07 $cov_pre_ce_pc_16 $sl_cov i.zone) (prog_area pre_ce_pc_07 $sl_cov i.zone, probit), vce(r)
eststo
teffects ipwra (pre_ce_log_pc_16 pre_ce_log_pc_07 $cov_pre_ce_log_pc_16 $sl_cov i.zone) (prog_area pre_ce_log_pc_07 $sl_cov i.zone, probit), vce(r)
eststo
teffects ipwra (dif_pre_ce_pc $cov_dif_pre_ce_pc $sl_cov i.zone) (prog_area $sl_cov i.zone, probit), vce(r)
eststo
teffects ipwra (dif_pre_ce_log_pc $cov_dif_pre_ce_log_pc $sl_cov i.zone) (prog_area $sl_cov i.zone, probit), vce(r)
eststo

esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\CE_ipwra.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)


***robust regression for continuous outcomes 

eststo clear

rreg sig_ce prog_area  $sl_cov i.zone 
eststo

rreg sig_ce_log prog_area  $sl_cov i.zone 
eststo

rreg sig_ce prog_area pre_ce_pc_07  $sl_cov i.zone
eststo

rreg sig_ce_log prog_area  pre_ce_log_pc_07 $sl_cov i.zone
eststo

rreg pre_ce_pc_16 prog_area pre_ce_pc_07  $sl_cov i.zone
eststo

rreg pre_ce_log_pc_16 prog_area pre_ce_log_pc_07  $sl_cov i.zone 
eststo

rreg dif_pre_ce_pc prog_area   $sl_cov i.zone 
eststo

rreg dif_pre_ce_log_pc prog_area   $sl_cov i.zone 
eststo

esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\ce_rreg.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)


***NN matching
**outcome variable list: sig_ce a_pca_07_by_z sig_ce_log pre_ce_pc_07 pre_ce_log_pc_07 pre_ce_pc_16  pre_ce_log_pc_16 dif_pre_ce_pc dif_pre_ce_log_pc

eststo clear

teffects nnmatch ( sig_ce   $sl_cov) (prog_area),  ematch(zone) biasadj( num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (sig_ce_log   $sl_cov) (prog_area),  ematch(zone) biasadj(  num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (sig_ce pre_ce_pc_07 $sl_cov) (prog_area),  ematch(zone) biasadj(pre_ce_pc_07 num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (sig_ce_log pre_ce_log_pc_07 $sl_cov) (prog_area),  ematch(zone) biasadj(pre_ce_log_pc_07 num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (pre_ce_pc_16 pre_ce_pc_07 $sl_cov) (prog_area),  ematch(zone) biasadj(pre_ce_pc_07 num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (pre_ce_log_pc_16 pre_ce_log_pc_07 $sl_cov) (prog_area),  ematch(zone) biasadj(pre_ce_log_pc_07 num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (dif_pre_ce_pc $sl_cov) (prog_area),  ematch(zone) biasadj(num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (dif_pre_ce_log_pc $sl_cov) (prog_area),  ematch(zone) biasadj(num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo


esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\CE_nn.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



***quantile reg

eststo clear

qreg sig_ce prog_area $sl_cov i.zone 
eststo

qreg sig_ce_log prog_area  $sl_cov i.zone 
eststo

qreg sig_ce prog_area pre_ce_pc_07  $sl_cov i.zone
eststo

qreg sig_ce_log prog_area  pre_ce_log_pc_07 $sl_cov i.zone
eststo

qreg pre_ce_pc_16 prog_area pre_ce_pc_07  $sl_cov i.zone
eststo

qreg pre_ce_log_pc_16 prog_area pre_ce_log_pc_07  $sl_cov i.zone 
eststo

qreg dif_pre_ce_pc prog_area   $sl_cov i.zone 
eststo

qreg dif_pre_ce_log_pc prog_area   $sl_cov i.zone 
eststo

esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\ce_qreg.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)


**outcome variable list: sig_ce a_pca_07_by_z sig_ce_log pre_ce_pc_07 pre_ce_log_pc_07 pre_ce_pc_16  pre_ce_log_pc_16 dif_pre_ce_pc dif_pre_ce_log_pc

***2SLS
eststo clear

ivregress 2sls sig_ce  $sl_cov i.zone (vi_group = prog_area  $sl_cov), cluster(groupid) 
eststo

ivregress 2sls sig_ce_log  $sl_cov i.zone (vi_group = prog_area  $sl_cov), cluster(groupid) 
eststo

ivregress 2sls sig_ce pre_ce_pc_07  $sl_cov i.zone (vi_group = prog_area pre_ce_pc_07  $sl_cov), cluster(groupid) 
eststo

ivregress 2sls sig_ce_log pre_ce_log_pc_07 $sl_cov i.zone (vi_group = prog_area pre_ce_log_pc_07 $sl_cov), cluster(groupid) 
eststo

ivregress 2sls pre_ce_pc_16 $sl_cov i.zone (vi_group = prog_area pre_ce_pc_07 $sl_cov), cluster(groupid) 
eststo

ivregress 2sls pre_ce_log_pc_16 $sl_cov i.zone (vi_group = prog_area pre_ce_log_pc_07 $sl_cov), cluster(groupid) 
eststo

ivregress 2sls dif_pre_ce_pc $sl_cov i.zone (vi_group = prog_area  $sl_cov), cluster(groupid) 
eststo

ivregress 2sls dif_pre_ce_log_pc $sl_cov i.zone (vi_group = prog_area  $sl_cov), cluster(groupid) 
eststo


esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\CE_2sls.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)


*examine zone specific differences

**outcome variable list: sig_ce a_pca_07_by_z sig_ce_log pre_ce_pc_07 pre_ce_log_pc_07 pre_ce_pc_16  pre_ce_log_pc_16 dif_pre_ce_pc dif_pre_ce_log_pc

eststo clear
 
reg sig_ce samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
eststo
reg sig_ce_log samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
eststo
reg sig_ce samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa pre_ce_pc_07 $sl_cov i.zone , cluster(groupid)
eststo
reg sig_ce_log samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  pre_ce_log_pc_07 $sl_cov i.zone , cluster(groupid)
eststo
reg pre_ce_pc_16 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa pre_ce_pc_07 $sl_cov i.zone , cluster(groupid)
eststo
reg pre_ce_log_pc_16 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa pre_ce_log_pc_07 $sl_cov i.zone , cluster(groupid)
eststo
reg dif_pre_ce_pc samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
eststo
reg dif_pre_ce_log_pc samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa $sl_cov i.zone , cluster(groupid)
eststo


esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\assets_vsz_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)


eststo clear
 
rreg sig_ce samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone 
eststo
rreg sig_ce_log samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone 
eststo
rreg sig_ce samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa pre_ce_pc_07 $sl_cov i.zone 
eststo
rreg sig_ce_log samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  pre_ce_log_pc_07 $sl_cov i.zone 
eststo
rreg pre_ce_pc_16 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa pre_ce_pc_07 $sl_cov i.zone 
eststo
rreg pre_ce_log_pc_16 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa pre_ce_log_pc_07 $sl_cov i.zone 
eststo
rreg dif_pre_ce_pc samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone 
eststo
rreg dif_pre_ce_log_pc samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa $sl_cov i.zone 
eststo


esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\ce_vsz_dif_effect-rreg.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



***implement Wald test to assess how different coefficients are

**sig_ce

eststo clear

reg sig_ce samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg sig_ce samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg sig_ce samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa a_pca_07_by_z $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg sig_ce samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa a_pca_07_by_z $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg sig_ce samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa a_pca_07_by_z $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg sig_ce samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa a_pca_07_by_z $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 


**sig_ce_log

eststo clear

reg sig_ce_log samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg sig_ce_log samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg sig_ce_log samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg sig_ce_log samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg sig_ce_log samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg sig_ce_log samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 


**sig_ce

eststo clear

reg sig_ce samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa pre_ce_pc_07  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg sig_ce samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa pre_ce_pc_07 $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg sig_ce samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa pre_ce_pc_07 $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg sig_ce samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa pre_ce_pc_07 $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg sig_ce samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa pre_ce_pc_07  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg sig_ce samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa pre_ce_pc_07 $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 

**sig_ce_log 

eststo clear

reg sig_ce_log samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa pre_ce_log_pc_07 $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg sig_ce_log samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa pre_ce_log_pc_07 $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg sig_ce_log samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa pre_ce_log_pc_07 $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg sig_ce_log samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa pre_ce_log_pc_07 $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg sig_ce_log samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa pre_ce_log_pc_07 $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg sig_ce_log samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa pre_ce_log_pc_07 $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 


**pre_ce_pc_16 

eststo clear

reg pre_ce_pc_16  samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa pre_ce_pc_07 $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg pre_ce_pc_16  samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa pre_ce_pc_07  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg pre_ce_pc_16  samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa pre_ce_pc_07 $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg pre_ce_pc_16  samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa pre_ce_pc_07 $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg pre_ce_pc_16  samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa pre_ce_pc_07 $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg pre_ce_pc_16  samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa pre_ce_pc_07 $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 


**pre_ce_log_pc_16 

eststo clear

reg pre_ce_log_pc_16   samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa pre_ce_log_pc_07 $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg pre_ce_log_pc_16   samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa pre_ce_log_pc_07 $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg pre_ce_log_pc_16   samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa pre_ce_log_pc_07 $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg pre_ce_log_pc_16   samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa pre_ce_log_pc_07 $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg pre_ce_log_pc_16   samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa pre_ce_log_pc_07 $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg pre_ce_log_pc_16   samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa pre_ce_log_pc_07 $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 

**dif_pre_ce_pc 

eststo clear

reg dif_pre_ce_pc    samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg dif_pre_ce_pc    samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg dif_pre_ce_pc    samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg dif_pre_ce_pc    samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg dif_pre_ce_pc    samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg dif_pre_ce_pc    samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 


**dif_pre_ce_log_pc 

eststo clear

reg dif_pre_ce_log_pc     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg dif_pre_ce_log_pc     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg dif_pre_ce_log_pc     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg dif_pre_ce_log_pc     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg dif_pre_ce_log_pc     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg dif_pre_ce_log_pc     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 



***Differential effects -- Gender

**gen treatment dummies for female and male
g prog_area_f = (res_female==1 & prog_area==1)
g prog_area_m = (res_female==0 & prog_area==1)


**outcome variable list: sig_ce a_pca_07_by_z sig_ce_log pre_ce_pc_07 pre_ce_log_pc_07 pre_ce_pc_16  pre_ce_log_pc_16 dif_pre_ce_pc dif_pre_ce_log_pc


**examine gender specific differences

eststo clear

reg sig_ce prog_area_f prog_area_m res_female   $sl_cov i.zone  , cluster(groupid)
eststo
reg sig_ce_log prog_area_f prog_area_m res_female  $sl_cov i.zone  , cluster(groupid)
eststo
reg sig_ce prog_area_f prog_area_m res_female pre_ce_pc_07  $sl_cov i.zone  , cluster(groupid)
eststo
reg sig_ce_log prog_area_f prog_area_m res_female pre_ce_log_pc_07 $sl_cov i.zone  , cluster(groupid)
eststo
reg pre_ce_pc_16 prog_area_f prog_area_m res_female pre_ce_pc_07  $sl_cov i.zone  , cluster(groupid)
eststo
reg pre_ce_log_pc_16 prog_area_f prog_area_m res_female pre_ce_log_pc_07 $sl_cov i.zone  , cluster(groupid)
eststo
reg dif_pre_ce_pc prog_area_f prog_area_m res_female   $sl_cov i.zone  , cluster(groupid)
eststo
reg dif_pre_ce_log_pc prog_area_f prog_area_m res_female  $sl_cov i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\CE_gen_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



**Wald tests for gender

***variables: sig_ce sig_ce_log sig_ce sig_ce_log pre_ce_pc_16 pre_ce_log_pc_16 dif_pre_ce_pc dif_pre_ce_log_pc lstock_dif_p

eststo clear

reg sig_ce prog_area_f prog_area_m res_female   $sl_cov i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg sig_ce_log prog_area_f prog_area_m res_female   $sl_cov i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg sig_ce prog_area_f prog_area_m res_female $sl_cov pre_ce_pc_07 i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg sig_ce_log  prog_area_f prog_area_m res_female pre_ce_log_pc_07 $sl_cov i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


reg pre_ce_pc_16 prog_area_f prog_area_m res_female pre_ce_pc_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg pre_ce_log_pc_16 prog_area_f prog_area_m res_female pre_ce_log_pc_07 $sl_cov i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg dif_pre_ce_pc prog_area_f prog_area_m res_female   $sl_cov i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg dif_pre_ce_log_pc  prog_area_f prog_area_m res_female  $sl_cov i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

estout a b c d e f g h,  stats(test test_prob) 



****Do the above but with robust regression

**outcome variable list: sig_ce a_pca_07_by_z sig_ce_log pre_ce_pc_07 pre_ce_log_pc_07 pre_ce_pc_16  pre_ce_log_pc_16 dif_pre_ce_pc dif_pre_ce_log_pc


**examine gender specific differences

eststo clear

rreg sig_ce prog_area_f prog_area_m res_female   $sl_cov i.zone  
eststo

rreg sig_ce_log prog_area_f prog_area_m res_female  $sl_cov i.zone  
eststo

rreg sig_ce prog_area_f prog_area_m res_female pre_ce_pc_07  $sl_cov i.zone  
eststo

rreg sig_ce_log prog_area_f prog_area_m res_female pre_ce_log_pc_07 $sl_cov i.zone  
eststo

rreg pre_ce_pc_16 prog_area_f prog_area_m res_female pre_ce_pc_07  $sl_cov i.zone  
eststo

rreg pre_ce_log_pc_16 prog_area_f prog_area_m res_female pre_ce_log_pc_07 $sl_cov i.zone  
eststo

rreg dif_pre_ce_pc prog_area_f prog_area_m res_female   $sl_cov i.zone 
eststo

rreg dif_pre_ce_log_pc prog_area_f prog_area_m res_female  $sl_cov i.zone  
eststo


esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\CE_gen_dif_effect_rreg.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)





**Wald tests for gender

***variables: sig_ce sig_ce_log sig_ce sig_ce_log pre_ce_pc_16 pre_ce_log_pc_16 dif_pre_ce_pc dif_pre_ce_log_pc lstock_dif_p

eststo clear

rreg sig_ce prog_area_f prog_area_m res_female   $sl_cov i.zone  
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

rreg sig_ce_log prog_area_f prog_area_m res_female   $sl_cov i.zone  
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

rreg sig_ce prog_area_f prog_area_m res_female $sl_cov pre_ce_pc_07 i.zone  
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

rreg sig_ce_log  prog_area_f prog_area_m res_female pre_ce_log_pc_07 $sl_cov i.zone 
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


rreg pre_ce_pc_16 prog_area_f prog_area_m res_female pre_ce_pc_07  $sl_cov i.zone  
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

rreg pre_ce_log_pc_16 prog_area_f prog_area_m res_female pre_ce_log_pc_07 $sl_cov i.zone 
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

rreg dif_pre_ce_pc prog_area_f prog_area_m res_female   $sl_cov i.zone  
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

rreg dif_pre_ce_log_pc  prog_area_f prog_area_m res_female  $sl_cov i.zone  
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

estout a b c d e f g h,  stats(test test_prob) 



eststo clear

qreg sig_ce prog_area_f prog_area_m res_female   $sl_cov i.zone  
eststo

qreg sig_ce_log prog_area_f prog_area_m res_female  $sl_cov i.zone  
eststo

qreg sig_ce prog_area_f prog_area_m res_female pre_ce_pc_07  $sl_cov i.zone  
eststo

qreg sig_ce_log prog_area_f prog_area_m res_female pre_ce_log_pc_07 $sl_cov i.zone  
eststo

qreg pre_ce_pc_16 prog_area_f prog_area_m res_female pre_ce_pc_07  $sl_cov i.zone  
eststo

qreg pre_ce_log_pc_16 prog_area_f prog_area_m res_female pre_ce_log_pc_07 $sl_cov i.zone  
eststo

qreg dif_pre_ce_pc prog_area_f prog_area_m res_female   $sl_cov i.zone 
eststo

qreg dif_pre_ce_log_pc prog_area_f prog_area_m res_female  $sl_cov i.zone  
eststo


esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\CE_gen_dif_effect_qreg.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)




**Wald tests for gender

***variables: sig_ce sig_ce_log sig_ce sig_ce_log pre_ce_pc_16 pre_ce_log_pc_16 dif_pre_ce_pc dif_pre_ce_log_pc lstock_dif_p

eststo clear

qreg sig_ce prog_area_f prog_area_m res_female   $sl_cov i.zone  
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

qreg sig_ce_log prog_area_f prog_area_m res_female   $sl_cov i.zone  
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

qreg sig_ce prog_area_f prog_area_m res_female $sl_cov pre_ce_pc_07 i.zone  
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

qreg sig_ce_log  prog_area_f prog_area_m res_female pre_ce_log_pc_07 $sl_cov i.zone 
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


qreg pre_ce_pc_16 prog_area_f prog_area_m res_female pre_ce_pc_07  $sl_cov i.zone  
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

qreg pre_ce_log_pc_16 prog_area_f prog_area_m res_female pre_ce_log_pc_07 $sl_cov i.zone 
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

qreg dif_pre_ce_pc prog_area_f prog_area_m res_female   $sl_cov i.zone  
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

qreg dif_pre_ce_log_pc  prog_area_f prog_area_m res_female  $sl_cov i.zone  
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

estout a b c d e f g h,  stats(test test_prob) 





***Differential effects -- Sex of HH Head

***variables: sig_ce sig_ce_log sig_ce sig_ce_log pre_ce_pc_16 pre_ce_log_pc_16 dif_pre_ce_pc dif_pre_ce_log_pc lstock_dif_p

**gen treatment dummies for female and male
g prog_area_f_h_h = (fem_headed==1 & prog_area==1)
g prog_area_m_h_h = (fem_headed==0 & prog_area==1)


eststo clear

reg sig_ce prog_area_f_h prog_area_m_h fem_headed   $sl_cov i.zone  , cluster(groupid)
eststo

reg sig_ce_log prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
eststo

reg sig_ce prog_area_f_h prog_area_m_h fem_headed pre_ce_pc_07 $sl_cov i.zone  , cluster(groupid)
eststo

reg sig_ce_log prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
eststo

reg pre_ce_pc_16 prog_area_f_h prog_area_m_h fem_headed pre_ce_pc_07  $sl_cov i.zone  , cluster(groupid)
eststo

reg pre_ce_log_pc_16 prog_area_f_h prog_area_m_h fem_headed pre_ce_log_pc_07 $sl_cov i.zone  , cluster(groupid)
eststo

reg dif_pre_ce_pc prog_area_f_h prog_area_m_h fem_headed   $sl_cov i.zone  , cluster(groupid)
eststo

reg dif_pre_ce_log_pc prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
eststo


esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\CE_fhh_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

***variables: sig_ce sig_ce_log sig_ce sig_ce_log pre_ce_pc_16 pre_ce_log_pc_16 dif_pre_ce_pc dif_pre_ce_log_pc lstock_dif_p

eststo clear

reg sig_ce prog_area_f_h prog_area_m_h fem_headed   $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg sig_ce_log prog_area_f_h prog_area_m_h fem_headed   $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg sig_ce prog_area_f_h prog_area_m_h fem_headed pre_ce_pc_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg sig_ce_log  prog_area_f_h prog_area_m_h fem_headed pre_ce_log_pc_07 $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg pre_ce_pc_16 prog_area_f_h prog_area_m_h fem_headed pre_ce_pc_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg pre_ce_log_pc_16 prog_area_f_h prog_area_m_h fem_headed pre_ce_log_pc_07 $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg dif_pre_ce_pc prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg dif_pre_ce_log_pc  prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h


estout a b c d e f g h,  stats(test test_prob) 



***Differential effects -- Education of respondent

**gen treatment dummies
g prog_area_8p_edu = (educat_res>7 & prog_area==1)
g prog_area_8u_edu = (educat_res<8 & prog_area==1)

g res_over_7_edu = (educat_res>7)

***variables: sig_ce sig_ce_log sig_ce sig_ce_log pre_ce_pc_16 pre_ce_log_pc_16 dif_pre_ce_pc dif_pre_ce_log_pc lstock_dif_p

eststo clear

reg sig_ce prog_area_8p_edu prog_area_8u_edu res_over_7_edu   $sl_cov i.zone  , cluster(groupid)
eststo

reg sig_ce_log prog_area_8p_edu prog_area_8u_edu res_over_7_edu $sl_cov i.zone  , cluster(groupid)
eststo

reg sig_ce prog_area_8p_edu prog_area_8u_edu res_over_7_edu pre_ce_pc_07  $sl_cov i.zone  , cluster(groupid)
eststo

reg sig_ce_log prog_area_8p_edu prog_area_8u_edu res_over_7_edu pre_ce_log_pc_07 $sl_cov i.zone  , cluster(groupid)
eststo

reg pre_ce_pc_16 prog_area_8p_edu prog_area_8u_edu res_over_7_edu pre_ce_pc_07  $sl_cov i.zone  , cluster(groupid)
eststo

reg pre_ce_log_pc_16 prog_area_8p_edu prog_area_8u_edu res_over_7_edu pre_ce_log_pc_07 $sl_cov i.zone  , cluster(groupid)
eststo

reg dif_pre_ce_pc prog_area_8p_edu prog_area_8u_edu res_over_7_edu   $sl_cov i.zone  , cluster(groupid)
eststo

reg dif_pre_ce_log_pc prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\CE_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests for edu

***variables: sig_ce sig_ce_log sig_ce sig_ce_log pre_ce_pc_16 pre_ce_log_pc_16 dif_pre_ce_pc dif_pre_ce_log_pc 

eststo clear

reg sig_ce prog_area_8p_edu prog_area_8u_edu res_over_7_edu   $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg sig_ce_log prog_area_8p_edu prog_area_8u_edu res_over_7_edu   $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg sig_ce prog_area_8p_edu prog_area_8u_edu res_over_7_edu pre_ce_pc_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg sig_ce_log  prog_area_8p_edu prog_area_8u_edu res_over_7_edu pre_ce_log_pc_07 $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


reg pre_ce_pc_16 prog_area_8p_edu prog_area_8u_edu res_over_7_edu pre_ce_pc_07 $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg pre_ce_log_pc_16 prog_area_8p_edu prog_area_8u_edu res_over_7_edu pre_ce_log_pc_07 $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg dif_pre_ce_pc prog_area_8p_edu prog_area_8u_edu res_over_7_edu   $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg dif_pre_ce_log_pc  prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

estout a b c d e f g h,  stats(test test_prob) 



***Differential effects -- Baseline Wealth

**gen treatment dummies 
xtile a_pca_07_by_z_bin =  a_pca_07_by_z , n(2)

g prog_area_asset_poor = (a_pca_07_by_z_bin==1 & prog_area==1)
g prog_area_asset_rich = (a_pca_07_by_z_bin==2 & prog_area==1)

g bl_asset_rich = (a_pca_07_by_z_bin==2)
g bl_asset_poor = (a_pca_07_by_z_bin==1)

***variables: sig_ce sig_ce_log sig_ce sig_ce_log pre_ce_pc_16 pre_ce_log_pc_16 dif_pre_ce_pc dif_pre_ce_log_pc 

**examine sub-group specific differences

eststo clear

reg sig_ce prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov i.zone  , cluster(groupid)
eststo

reg sig_ce_log prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov i.zone  , cluster(groupid)
eststo

reg sig_ce prog_area_asset_poor prog_area_asset_rich bl_asset_poor pre_ce_pc_07 $sl_cov i.zone  , cluster(groupid)
eststo

reg sig_ce_log prog_area_asset_poor prog_area_asset_rich bl_asset_poor pre_ce_log_pc_07 $sl_cov i.zone  , cluster(groupid)
eststo

reg pre_ce_pc_16 prog_area_asset_poor prog_area_asset_rich bl_asset_poor pre_ce_pc_07 $sl_cov i.zone  , cluster(groupid)
eststo

reg pre_ce_log_pc_16 prog_area_asset_poor prog_area_asset_rich bl_asset_poor pre_ce_log_pc_07 $sl_cov i.zone  , cluster(groupid)
eststo

reg dif_pre_ce_pc prog_area_asset_poor prog_area_asset_rich bl_asset_poor   $sl_cov i.zone  , cluster(groupid)
eststo

reg dif_pre_ce_log_pc prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov i.zone  , cluster(groupid)
eststo


esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\CE_wealth_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

***variables: sig_ce sig_ce_log sig_ce sig_ce_log pre_ce_pc_16 pre_ce_log_pc_16 dif_pre_ce_pc dif_pre_ce_log_pc 

eststo clear

reg sig_ce prog_area_asset_poor prog_area_asset_rich bl_asset_poor   $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg sig_ce_log prog_area_asset_poor prog_area_asset_rich bl_asset_poor   $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg sig_ce prog_area_asset_poor prog_area_asset_rich bl_asset_poor pre_ce_pc_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg sig_ce_log  prog_area_asset_poor prog_area_asset_rich bl_asset_poor pre_ce_log_pc_07 $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


reg pre_ce_pc_16 prog_area_asset_poor prog_area_asset_rich bl_asset_poor  pre_ce_pc_07 $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg pre_ce_log_pc_16 prog_area_asset_poor prog_area_asset_rich bl_asset_poor pre_ce_log_pc_07 $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg dif_pre_ce_pc prog_area_asset_poor prog_area_asset_rich bl_asset_poor   $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg dif_pre_ce_log_pc  prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h


estout a b c d e f g h,  stats(test test_prob) 



***Differential effects -- Land Holding Size

**gen treatment dummies

g prog_area_land_u2 = (land_bl<2 & prog_area==1)
g prog_area_land_o2 = (land_b>=2 & prog_area==1)

g land_o2 = (land_b>=2)

***variables: sig_ce sig_ce_log sig_ce sig_ce_log pre_ce_pc_16 pre_ce_log_pc_16 dif_pre_ce_pc dif_pre_ce_log_pc 

**examine sub-group specific differences

eststo clear

reg sig_ce prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
eststo

reg sig_ce_log prog_area_land_u2 prog_area_land_o2 land_o2   $sl_cov i.zone  , cluster(groupid)
eststo

reg sig_ce prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone pre_ce_pc_07 , cluster(groupid)
eststo

reg sig_ce_log prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone pre_ce_log_pc_07  , cluster(groupid)
eststo

reg pre_ce_pc_16 prog_area_land_u2 prog_area_land_o2 land_o2 pre_ce_pc_07 $sl_cov i.zone  , cluster(groupid)
eststo

reg pre_ce_log_pc_16 prog_area_land_u2 prog_area_land_o2 land_o2 pre_ce_log_pc_07 $sl_cov i.zone  , cluster(groupid)
eststo

reg dif_pre_ce_pc prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
eststo

reg dif_pre_ce_log_pc prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\CE_land_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests for edu

***variables: sig_ce sig_ce_log sig_ce sig_ce_log pre_ce_pc_16 pre_ce_log_pc_16 dif_pre_ce_pc dif_pre_ce_log_pc

eststo clear

reg sig_ce prog_area_land_u2 prog_area_land_o2 land_o2   $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg sig_ce_log prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg sig_ce prog_area_land_u2 prog_area_land_o2 land_o2 pre_ce_pc_07 $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg sig_ce_log  prog_area_land_u2 prog_area_land_o2 land_o2 pre_ce_log_pc_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


reg pre_ce_pc_16 prog_area_land_u2 prog_area_land_o2 land_o2  pre_ce_pc_07 $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg pre_ce_log_pc_16 prog_area_land_u2 prog_area_land_o2 land_o2 pre_ce_log_pc_07 $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg dif_pre_ce_pc prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg dif_pre_ce_log_pc  prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

estout a b c d e f g h,  stats(test test_prob) 


***Differential effects -- Dairy Farmers

**gen treatment dummies

g prog_area_dar = (dar_prod==1 & prog_area==1)
g prog_area_no_dar = (dar_prod==0 & prog_area==1)

**examine sub-group specific differences

***variables: sig_ce sig_ce_log sig_ce sig_ce_log pre_ce_pc_16 pre_ce_log_pc_16 dif_pre_ce_pc dif_pre_ce_log_pc 


eststo clear

reg sig_ce prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
eststo

reg sig_ce_log prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
eststo

reg sig_ce prog_area_dar prog_area_no_dar dar_prod  pre_ce_pc_07 $sl_cov i.zone  , cluster(groupid)
eststo

reg sig_ce_log prog_area_dar prog_area_no_dar dar_prod pre_ce_log_pc_07 $sl_cov i.zone  , cluster(groupid)
eststo

reg pre_ce_pc_16 prog_area_dar prog_area_no_dar dar_prod pre_ce_pc_07 $sl_cov i.zone  , cluster(groupid)
eststo

reg pre_ce_log_pc_16 prog_area_dar prog_area_no_dar dar_prod pre_ce_log_pc_07 $sl_cov i.zone  , cluster(groupid)
eststo

reg dif_pre_ce_pc prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
eststo

reg dif_pre_ce_log_pc prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
eststo


esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\dar_CE_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

***variables: sig_ce sig_ce_log sig_ce sig_ce_log pre_ce_pc_16 pre_ce_log_pc_16 dif_pre_ce_pc dif_pre_ce_log_pc 

eststo clear

reg sig_ce prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg sig_ce_log prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg sig_ce prog_area_dar prog_area_no_dar dar_prod pre_ce_pc_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg sig_ce_log  prog_area_dar prog_area_no_dar dar_prod pre_ce_log_pc_07 $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


reg pre_ce_pc_16 prog_area_dar prog_area_no_dar dar_prod  pre_ce_pc_07 $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg pre_ce_log_pc_16 prog_area_dar prog_area_no_dar dar_prod pre_ce_log_pc_07 $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg dif_pre_ce_pc prog_area_dar prog_area_no_dar dar_prod   $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg dif_pre_ce_log_pc  prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h


estout a b c d e f g h ,  stats(test test_prob) 



eststo clear

rreg sig_ce prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  
eststo

rreg sig_ce_log prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  
eststo

rreg sig_ce prog_area_dar prog_area_no_dar dar_prod  pre_ce_pc_07 $sl_cov i.zone 
eststo

rreg sig_ce_log prog_area_dar prog_area_no_dar dar_prod pre_ce_log_pc_07 $sl_cov i.zone  
eststo

rreg pre_ce_pc_16 prog_area_dar prog_area_no_dar dar_prod pre_ce_pc_07 $sl_cov i.zone  
eststo

rreg pre_ce_log_pc_16 prog_area_dar prog_area_no_dar dar_prod pre_ce_log_pc_07 $sl_cov i.zone  
eststo

rreg dif_pre_ce_pc prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  
eststo

rreg dif_pre_ce_log_pc prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\dar_CE_dif_effect_rreg.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

***variables: sig_ce sig_ce_log sig_ce sig_ce_log pre_ce_pc_16 pre_ce_log_pc_16 dif_pre_ce_pc dif_pre_ce_log_pc 

eststo clear

rreg sig_ce prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

rreg sig_ce_log prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

rreg sig_ce prog_area_dar prog_area_no_dar dar_prod pre_ce_pc_07  $sl_cov i.zone  
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

rreg sig_ce_log  prog_area_dar prog_area_no_dar dar_prod pre_ce_log_pc_07 $sl_cov i.zone  
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


rreg pre_ce_pc_16 prog_area_dar prog_area_no_dar dar_prod  pre_ce_pc_07 $sl_cov i.zone  
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

rreg pre_ce_log_pc_16 prog_area_dar prog_area_no_dar dar_prod pre_ce_log_pc_07 $sl_cov i.zone  
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

rreg dif_pre_ce_pc prog_area_dar prog_area_no_dar dar_prod   $sl_cov i.zone 
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

rreg dif_pre_ce_log_pc  prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone 
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h


estout a b c d e f g h ,  stats(test test_prob) 


eststo clear

qreg sig_ce prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  
eststo

qreg sig_ce_log prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  
eststo

qreg sig_ce prog_area_dar prog_area_no_dar dar_prod  pre_ce_pc_07 $sl_cov i.zone 
eststo

qreg sig_ce_log prog_area_dar prog_area_no_dar dar_prod pre_ce_log_pc_07 $sl_cov i.zone  
eststo

qreg pre_ce_pc_16 prog_area_dar prog_area_no_dar dar_prod pre_ce_pc_07 $sl_cov i.zone  
eststo

qreg pre_ce_log_pc_16 prog_area_dar prog_area_no_dar dar_prod pre_ce_log_pc_07 $sl_cov i.zone  
eststo

qreg dif_pre_ce_pc prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  
eststo

qreg dif_pre_ce_log_pc prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\dar_CE_dif_effect_qreg.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

***variables: sig_ce sig_ce_log sig_ce sig_ce_log pre_ce_pc_16 pre_ce_log_pc_16 dif_pre_ce_pc dif_pre_ce_log_pc 

eststo clear

qreg sig_ce prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

qreg sig_ce_log prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

qreg sig_ce prog_area_dar prog_area_no_dar dar_prod pre_ce_pc_07  $sl_cov i.zone  
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

qreg sig_ce_log  prog_area_dar prog_area_no_dar dar_prod pre_ce_log_pc_07 $sl_cov i.zone  
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


qreg pre_ce_pc_16 prog_area_dar prog_area_no_dar dar_prod  pre_ce_pc_07 $sl_cov i.zone  
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

qreg pre_ce_log_pc_16 prog_area_dar prog_area_no_dar dar_prod pre_ce_log_pc_07 $sl_cov i.zone  
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

qreg dif_pre_ce_pc prog_area_dar prog_area_no_dar dar_prod   $sl_cov i.zone 
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

qreg dif_pre_ce_log_pc  prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone 
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h


estout a b c d e f g h ,  stats(test test_prob) 





***Differential effects -- Official Position

**gen treatment dummies

g prog_area_OP = (official_role_res==1 & prog_area==1)
g prog_area_no_OP = (official_role_res==0 & prog_area==1)


**examine sub-group specific differences

***variables: sig_ce sig_ce_log sig_ce sig_ce_log pre_ce_pc_16 pre_ce_log_pc_16 dif_pre_ce_pc dif_pre_ce_log_pc

eststo clear

reg sig_ce prog_area_OP prog_area_no_OP official_role   $sl_cov i.zone  , cluster(groupid)
eststo

reg sig_ce_log prog_area_OP prog_area_no_OP official_role   $sl_cov i.zone  , cluster(groupid)
eststo

reg sig_ce prog_area_OP prog_area_no_OP official_role pre_ce_pc_07  $sl_cov i.zone  , cluster(groupid)
eststo

reg sig_ce_log prog_area_OP prog_area_no_OP official_role pre_ce_log_pc_07  $sl_cov i.zone  , cluster(groupid)
eststo

reg pre_ce_pc_16 prog_area_OP prog_area_no_OP official_role pre_ce_pc_07  $sl_cov i.zone  , cluster(groupid)
eststo

reg pre_ce_log_pc_16 prog_area_OP prog_area_no_OP official_role pre_ce_log_pc_07 $sl_cov i.zone  , cluster(groupid)
eststo

reg dif_pre_ce_pc prog_area_OP prog_area_no_OP official_role  $sl_cov i.zone  , cluster(groupid)
eststo

reg dif_pre_ce_log_pc prog_area_OP prog_area_no_OP official_role  $sl_cov i.zone  , cluster(groupid)
eststo


esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\CE_OP_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

***variables: sig_ce sig_ce_log sig_ce sig_ce_log pre_ce_pc_16 pre_ce_log_pc_16 dif_pre_ce_pc dif_pre_ce_log_pc

eststo clear

reg sig_ce prog_area_OP prog_area_no_OP official_role   $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg sig_ce_log prog_area_OP prog_area_no_OP official_role   $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg sig_ce prog_area_OP prog_area_no_OP official_role  pre_ce_pc_07 $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg sig_ce_log  prog_area_OP prog_area_no_OP official_role pre_ce_log_pc_07 $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


reg pre_ce_pc_16 prog_area_OP prog_area_no_OP official_role  pre_ce_pc_07 $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg pre_ce_log_pc_16 prog_area_OP prog_area_no_OP official_role pre_ce_log_pc_07 $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg dif_pre_ce_pc prog_area_OP prog_area_no_OP official_role  $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg dif_pre_ce_log_pc  prog_area_OP prog_area_no_OP official_role  $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h


estout a b c d e f g h,  stats(test test_prob) 



***Differential effects -- land ownership (not with spouse; formal or unformal title)

**gen treatment dummies

g prog_area_lnd_self = (lnd_self_07_2==1 & prog_area==1)
g prog_area_lnd_oth= (lnd_self_07_2==0 & prog_area==1)

g lnd_self = lnd_self_07_2
**examine sub-group specific differences

***variables: sig_ce sig_ce_log sig_ce sig_ce_log pre_ce_pc_16 pre_ce_log_pc_16 dif_pre_ce_pc dif_pre_ce_log_pc 


eststo clear

reg sig_ce prog_area_lnd_self prog_area_lnd_oth lnd_self  $sl_cov i.zone  , cluster(groupid)
eststo

reg sig_ce_log prog_area_lnd_self prog_area_lnd_oth lnd_self   $sl_cov i.zone  , cluster(groupid)
eststo

reg sig_ce prog_area_lnd_self prog_area_lnd_oth lnd_self pre_ce_pc_07  $sl_cov i.zone  , cluster(groupid)
eststo

reg sig_ce_log prog_area_lnd_self prog_area_lnd_oth lnd_self pre_ce_log_pc_07 $sl_cov i.zone  , cluster(groupid)
eststo

reg pre_ce_pc_16 prog_area_lnd_self prog_area_lnd_oth lnd_self  pre_ce_pc_07 $sl_cov i.zone  , cluster(groupid)
eststo

reg pre_ce_log_pc_16 prog_area_lnd_self prog_area_lnd_oth lnd_self pre_ce_log_pc_07 $sl_cov i.zone  , cluster(groupid)
eststo

reg dif_pre_ce_pc prog_area_lnd_self prog_area_lnd_oth lnd_self  $sl_cov i.zone  , cluster(groupid)
eststo

reg dif_pre_ce_log_pc prog_area_lnd_self prog_area_lnd_oth lnd_self  $sl_cov i.zone  , cluster(groupid)
eststo


esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\CE_land_own_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

***variables: sig_ce sig_ce_log sig_ce sig_ce_log pre_ce_pc_16 pre_ce_log_pc_16 dif_pre_ce_pc dif_pre_ce_log_pc 

eststo clear

reg sig_ce prog_area_lnd_self prog_area_lnd_oth lnd_self $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_self = prog_area_lnd_oth
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg sig_ce_log prog_area_lnd_self prog_area_lnd_oth lnd_self   $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_self = prog_area_lnd_oth
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg sig_ce prog_area_lnd_self prog_area_lnd_oth lnd_self   $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_self = prog_area_lnd_oth
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg sig_ce_log  prog_area_lnd_self prog_area_lnd_oth lnd_self  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_self = prog_area_lnd_oth
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


reg pre_ce_pc_16 prog_area_lnd_self prog_area_lnd_oth lnd_self   $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_self = prog_area_lnd_oth
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg pre_ce_log_pc_16 prog_area_lnd_self prog_area_lnd_oth lnd_self  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_self = prog_area_lnd_oth
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg dif_pre_ce_pc prog_area_lnd_self prog_area_lnd_oth lnd_self  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_self = prog_area_lnd_oth
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg dif_pre_ce_log_pc  prog_area_lnd_self prog_area_lnd_oth lnd_self  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_self = prog_area_lnd_oth
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

reg lstock_dif_p  prog_area_lnd_self prog_area_lnd_oth lnd_self  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_self = prog_area_lnd_oth
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store i

estout a b c d e f g i,  stats(test test_prob) 



***Differential effects -- land ownership (formal or unformal title with or without spouse)

**gen treatment dummies

g prog_area_lnd_hh = (lnd_self_07==1 & prog_area==1)
g prog_area_lnd_n_hh= (lnd_self_07==0 & prog_area==1)


**examine sub-group specific differences

******variables: sig_ce sig_ce_log sig_ce sig_ce_log pre_ce_pc_16 pre_ce_log_pc_16 dif_pre_ce_pc dif_pre_ce_log_pc


eststo clear

reg sig_ce prog_area_lnd_hh prog_area_lnd_n_hh lnd_self_07 a_pca_07_by_z  $sl_cov i.zone  , cluster(groupid)
eststo

reg sig_ce_log prog_area_lnd_hh prog_area_lnd_n_hh lnd_self_07 a_pca_07_by_z  $sl_cov i.zone  , cluster(groupid)
eststo

reg sig_ce prog_area_lnd_hh prog_area_lnd_n_hh lnd_self_07 pre_ce_pc_07  $sl_cov i.zone  , cluster(groupid)
eststo

reg sig_ce_log prog_area_lnd_hh prog_area_lnd_n_hh lnd_self_07 pre_ce_log_pc_07 $sl_cov i.zone  , cluster(groupid)
eststo

reg pre_ce_pc_16 prog_area_lnd_hh prog_area_lnd_n_hh lnd_self_07  pre_ce_pc_07 $sl_cov i.zone  , cluster(groupid)
eststo

reg pre_ce_log_pc_16 prog_area_lnd_hh prog_area_lnd_n_hh lnd_self_07 pre_ce_log_pc_07 $sl_cov i.zone  , cluster(groupid)
eststo

reg dif_pre_ce_pc prog_area_lnd_hh prog_area_lnd_n_hh lnd_self_07  $sl_cov i.zone  , cluster(groupid)
eststo

reg dif_pre_ce_log_pc prog_area_lnd_hh prog_area_lnd_n_hh lnd_self_07  $sl_cov i.zone  , cluster(groupid)
eststo


esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\CE_land_own_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

***variables: sig_ce sig_ce_log sig_ce sig_ce_log pre_ce_pc_16 pre_ce_log_pc_16 dif_pre_ce_pc dif_pre_ce_log_pc 

eststo clear

reg sig_ce prog_area_lnd_hh prog_area_lnd_n_hh lnd_self_07 a_pca_07_by_z  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_hh = prog_area_lnd_n_hh
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg sig_ce_log prog_area_lnd_hh prog_area_lnd_n_hh lnd_self_07 a_pca_07_by_z_by_z  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_hh = prog_area_lnd_n_hh
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg sig_ce prog_area_lnd_hh prog_area_lnd_n_hh lnd_self_07   $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_hh = prog_area_lnd_n_hh
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg sig_ce_log  prog_area_lnd_hh prog_area_lnd_n_hh lnd_self_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_hh = prog_area_lnd_n_hh
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


reg pre_ce_pc_16 prog_area_lnd_hh prog_area_lnd_n_hh lnd_self_07   $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_hh = prog_area_lnd_n_hh
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg pre_ce_log_pc_16 prog_area_lnd_hh prog_area_lnd_n_hh lnd_self_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_hh = prog_area_lnd_n_hh
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg dif_pre_ce_pc prog_area_lnd_hh prog_area_lnd_n_hh lnd_self_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_hh = prog_area_lnd_n_hh
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg dif_pre_ce_log_pc  prog_area_lnd_hh prog_area_lnd_n_hh lnd_self_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_hh = prog_area_lnd_n_hh
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

reg lstock_dif_p  prog_area_lnd_hh prog_area_lnd_n_hh lnd_self_07  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_hh = prog_area_lnd_n_hh
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store i

estout a b c d e f g i,  stats(test test_prob) 



***Differential effects -- land ownership formal title

**gen treatment dummies

g prog_area_lnd_tl = (lnd_title_07==1 & prog_area==1)
g prog_area_no_ln_tl= (lnd_title_07==0 & prog_area==1)


**examine sub-group specific differences

**
***variables: sig_ce sig_ce_log sig_ce sig_ce_log pre_ce_pc_16 pre_ce_log_pc_16 dif_pre_ce_pc dif_pre_ce_log_pc 


eststo clear

reg sig_ce prog_area_lnd_tl prog_area_no_ln_tl lnd_title_07 a_pca_07_by_z  $sl_cov i.zone  , cluster(groupid)
eststo

reg sig_ce_log prog_area_lnd_tl prog_area_no_ln_tl lnd_title_07 a_pca_07_by_z  $sl_cov i.zone  , cluster(groupid)
eststo

reg sig_ce prog_area_lnd_tl prog_area_no_ln_tl lnd_title_07 pre_ce_pc_07  $sl_cov i.zone  , cluster(groupid)
eststo

reg sig_ce_log prog_area_lnd_tl prog_area_no_ln_tl lnd_title_07 pre_ce_log_pc_07 $sl_cov i.zone  , cluster(groupid)
eststo

reg pre_ce_pc_16 prog_area_lnd_tl prog_area_no_ln_tl lnd_title_07 pre_ce_pc_07  $sl_cov i.zone  , cluster(groupid)
eststo

reg pre_ce_log_pc_16 prog_area_lnd_tl prog_area_no_ln_tl lnd_title_07 pre_ce_log_pc_07 $sl_cov i.zone  , cluster(groupid)
eststo

reg dif_pre_ce_pc prog_area_lnd_tl prog_area_no_ln_tl lnd_title_07  $sl_cov i.zone  , cluster(groupid)
eststo

reg dif_pre_ce_log_pc prog_area_lnd_tl prog_area_no_ln_tl lnd_title_07  $sl_cov i.zone  , cluster(groupid)
eststo


esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\CE_land_title_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

***variables: sig_ce sig_ce_log sig_ce sig_ce_log pre_ce_pc_16 pre_ce_log_pc_16 dif_pre_ce_pc dif_pre_ce_log_pc 

eststo clear

reg sig_ce prog_area_lnd_tl prog_area_no_ln_tl lnd_self a_pca_07_by_z  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_tl = prog_area_no_ln_tl
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg sig_ce_log prog_area_lnd_tl prog_area_no_ln_tl lnd_self a_pca_07_by_z_by_z  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_tl = prog_area_no_ln_tl
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg sig_ce prog_area_lnd_tl prog_area_no_ln_tl lnd_self   $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_tl = prog_area_no_ln_tl
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg sig_ce_log  prog_area_lnd_tl prog_area_no_ln_tl lnd_self  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_tl = prog_area_no_ln_tl
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


reg pre_ce_pc_16 prog_area_lnd_tl prog_area_no_ln_tl lnd_self   $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_tl = prog_area_no_ln_tl
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg pre_ce_log_pc_16 prog_area_lnd_tl prog_area_no_ln_tl lnd_self  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_tl = prog_area_no_ln_tl
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg dif_pre_ce_pc prog_area_lnd_tl prog_area_no_ln_tl lnd_self  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_tl = prog_area_no_ln_tl
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg dif_pre_ce_log_pc  prog_area_lnd_tl prog_area_no_ln_tl lnd_self  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_tl = prog_area_no_ln_tl
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

reg lstock_dif_p  prog_area_lnd_tl prog_area_no_ln_tl lnd_self  $sl_cov i.zone  , cluster(groupid)
test prog_area_lnd_tl = prog_area_no_ln_tl
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store i

estout a b c d e f g i,  stats(test test_prob) 


*******Robustness tests for key differential effects

**variables correlated with female only prog_area

***max_edu_hh soc_07_avg _hh_loc_altitude res_widow res_head official_role_res hh_lstock_07 hh_emp_07 hh_on_road lnd_self_07_2

reg dif_pre_ce_pc prog_area  max_edu_hh soc_07_avg _hh_loc_altitude res_married res_widow res_head  hh_lstock_07 hh_emp_07 hh_on_road lnd_self_07_2 i.zone if res_female==1 , cluster(groupid)

rreg dif_pre_ce_pc prog_area  max_edu_hh soc_07_avg _hh_loc_altitude res_married res_widow res_head  hh_lstock_07 hh_emp_07 hh_on_road lnd_self_07_2 i.zone if res_female==1 

reg a_pca_p_dif_2 prog_area  max_edu_hh soc_07_avg _hh_loc_altitude res_married res_widow res_head  hh_lstock_07 hh_emp_07 hh_on_road lnd_self_07_2 i.zone if res_female==1 , cluster(groupid)

rreg a_pca_p_dif_2 prog_area  max_edu_hh soc_07_avg _hh_loc_altitude res_married res_widow res_head  hh_lstock_07 hh_emp_07 hh_on_road lnd_self_07_2 i.zone if res_female==1 


*=======================================================================================================
****Coping Strategies Index and Food Security
*=======================================================================================================

***outcome list: cop_stra cop_stra_bin sell_asset mdd_raw mdd_bin mdd_grp_5 mahfp_16 mahfp_dif mahfp_p_change


****Generate raw stats

eststo clear

local fs_list  cop_stra cop_stra_bin sell_asset_bin mdd_raw mdd_bin mdd_grp_5 mahfp_16 mahfp_dif mahfp_p_change

estpost tabstat `fs_list' , statistics(n mean) columns(statistics)
eststo

estpost tabstat `fs_list' if prog_area==1  , statistics(n mean) columns(statistics)
eststo

estpost tabstat `fs_list' if prog_area==0 , statistics(n mean) columns(statistics)
eststo
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\fs_list_unaj_mean.csv", r  nogaps modelwidth(4) cells(mean(f(2))) 

**unajusted t-tests

eststo clear
local fs_list  cop_stra cop_stra_bin sell_asset_bin mdd_raw mdd_bin mdd_grp_5 mahfp_16 mahfp_dif mahfp_p_change
foreach var of local fs_list {
reg `var' prog_area , robust
eststo
}

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\fs_list_unaj_ttests.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



eststo clear

local fs_list  cop_stra cop_stra_bin sell_asset_bin mdd_raw mdd_bin mdd_grp_5 mahfp_16 mahfp_dif mahfp_p_change

estpost tabstat `fs_list', statistics(n median) columns(statistics)
eststo

estpost tabstat `fs_list' if prog_area==1, statistics(n median) columns(statistics)
eststo

estpost tabstat `fs_list' if prog_area==0, statistics(n median) columns(statistics)
eststo
esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\fs_list_unaj_median.csv", r  label nogaps modelwidth(4) cells(p50 (f(2))) 

**unajusted t-tests

eststo clear
local fs_list  cop_stra cop_stra_bin sell_asset_bin mdd_raw mdd_bin mdd_grp_5 mahfp_16 mahfp_dif mahfp_p_change
foreach var of local fs_list {
qreg `var' prog_area
eststo
}

esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\fs_list_fw_unaj_qreg.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)


gl sl_cov "res_female res_head res_spo_head r_tech_skill hh_lstock_07 hh_emp_07 elder_headed num_child max_edu_hh soc_07_avg hh_dist_tarma lnd_self_07_2"

***OLS with robust clustered standard errors
***outcome list: cop_stra cop_stra_bin sell_asset_bin mdd_raw mdd_bin mdd_grp_5 mahfp_16 mahfp_dif mahfp_p_change

gl sl_cov "res_female res_head res_spo_head r_tech_skill hh_lstock_07 hh_emp_07 elder_headed num_child max_edu_hh soc_07_avg hh_dist_tarma lnd_self_07_2"

***given that those who experienced shock are subsample have specific set of covariates for them
gl sl_cov_shock "num_child soc_07_avg _hh_loc_altitude res_female res_head res_spo_head r_tech_skill hh_lstock_07 hh_bus_07 hh_emp_07 elder_headed lnd_self_07_2"


eststo clear

reg cop_stra prog_area  $sl_cov_shock i.zone , cluster(groupid)
eststo

probit cop_stra_bin prog_area  $sl_cov_shock i.zone , cluster(groupid)
eststo

probit sell_asset_bin prog_area   $sl_cov_shock i.zone, cluster(groupid)
eststo

reg mdd_raw  prog_area  $sl_cov i.zone, cluster(groupid)
eststo

probit mdd_bin prog_area   $sl_cov i.zone , cluster(groupid)
eststo

probit mdd_grp_5 prog_area   $sl_cov i.zone , cluster(groupid)
eststo

reg mahfp_16 prog_area   $sl_cov i.zone , cluster(groupid)
eststo

reg mahfp_dif prog_area   $sl_cov i.zone , cluster(groupid)
eststo

probit mahfp_p_change prog_area   $sl_cov i.zone , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\fs_ols.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

num_child soc_07_avg _hh_loc_altitude res_female res_head res_spo_head r_tech_skill hh_lstock_07 hh_bus_07 hh_emp_07 elder_headed lnd_self_07_2

***IPWRA

**shortlist cov. correlated with Y


stepwise, pr (.1): reg cop_stra $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_cop_stra "`X'"

stepwise, pr (.1): probit cop_stra_bin $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_cop_stra_bin "`X'"

stepwise, pr (.1): probit sell_asset_bin $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_sell_asset_bin "`X'"

stepwise, pr (.1): reg mdd_raw  $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_mdd_raw  "`X'"

stepwise, pr (.1): probit mdd_bin  $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_mdd_bin  "`X'"

stepwise, pr (.1): probit mdd_grp_5  $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_mdd_grp_5  "`X'"

stepwise, pr (.1): reg mahfp_16  $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_mahfp_16 "`X'"

stepwise, pr (.1): reg mahfp_dif  $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_mahfp_dif  "`X'"

stepwise, pr (.1): probit mahfp_p_change  $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_mahfp_p_change  "`X'"


eststo clear

teffects ipwra (cop_stra $cov_cop_stra $sl_cov_shock i.zone) (prog_area $sl_cov_shock i.zone, probit), vce(r)
eststo

teffects ipwra (cop_stra_bin $cov_cop_stra_bin $sl_cov_shock i.zone, probit) (prog_area $sl_cov_shock i.zone, probit), vce(r)
eststo
teffects ipwra (sell_asset_bin $cov_sell_asset_bin $sl_cov_shock i.zone, probit) (prog_area $sl_cov_shock i.zone, probit), vce(r)
eststo

teffects ipwra (mdd_raw $cov_mdd_raw $sl_cov i.zone) (prog_area $sl_cov i.zone, probit), vce(r)
eststo
teffects ipwra (mdd_bin $cov_mdd_bin $sl_cov i.zone, probit) (prog_area $sl_cov i.zone, probit), vce(r)
eststo

teffects ipwra (mdd_grp_5 $cov_mdd_grp_5 $sl_cov i.zone, probit) (prog_area $sl_cov i.zone, probit), vce(r)
eststo
teffects ipwra (mahfp_16 $cov_mahfp_16 $sl_cov i.zone) (prog_area $sl_cov i.zone, probit), vce(r)
eststo

teffects ipwra (mahfp_dif $cov_mahfp_dif $sl_cov i.zone) (prog_area $sl_cov i.zone, probit), vce(r)
eststo
teffects ipwra (mahfp_p_change $cov_mahfp_p_change $sl_cov i.zone, probit) (prog_area $sl_cov i.zone, probit), vce(r)
eststo

esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\fs_ipwra.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)


***robust regression for continuous outcomes 

eststo clear

rreg cop_stra prog_area  $sl_cov_shock i.zone
eststo
rreg mdd_raw  prog_area  $sl_cov i.zone
eststo
rreg mahfp_16 prog_area   $sl_cov i.zone 
eststo
rreg mahfp_dif prog_area   $sl_cov i.zone 
eststo

esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\fs_rreg.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)


***NN matching
***outcome list: cop_stra cop_stra_bin sell_asset_bin mdd_raw mdd_bin mdd_grp_5 mahfp_16 mahfp_dif mahfp_p_change
eststo clear

teffects nnmatch (cop_stra $sl_cov_shock) (prog_area),  ematch(zone) biasadj(num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (cop_stra_bin  $sl_cov_shock) (prog_area),  ematch(zone) biasadj(num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (sell_asset_bin $sl_cov_shock) (prog_area),  ematch(zone) biasadj(num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (mdd_raw  $sl_cov) (prog_area),  ematch(zone) biasadj( num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (mdd_bin  $sl_cov) (prog_area),  ematch(zone) biasadj(num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (mdd_grp_5  $sl_cov) (prog_area),  ematch(zone) biasadj(num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (mahfp_16  $sl_cov) (prog_area),  ematch(zone) biasadj(num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (mahfp_dif  $sl_cov) (prog_area),  ematch(zone) biasadj(num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (mahfp_p_change $sl_cov) (prog_area),  ematch(zone) biasadj(num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo


esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\fs_nn.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

***quantile reg

eststo clear

qreg cop_stra prog_area  $sl_cov_shock i.zone
eststo

qreg mdd_raw  prog_area  $sl_cov i.zone
eststo

qreg mahfp_16 prog_area   $sl_cov i.zone 
eststo

esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\fs_qreg.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



***outcome list: cop_stra cop_stra_bin sell_asset_bin mdd_raw mdd_bin mdd_grp_5 mahfp_16 mahfp_dif mahfp_p_change

***2SLS
eststo clear

ivregress 2sls cop_stra $sl_cov_shock i.zone (vi_group = prog_area  $sl_cov), cluster(groupid) 
eststo

ivprobit cop_stra_bin $sl_cov_shock i.zone (vi_group = prog_area $sl_cov), vce(cluster groupid)
eststo

ivprobit sell_asset_bin $sl_cov_shock i.zone (vi_group = prog_area $sl_cov), vce(cluster groupid)
eststo

ivregress 2sls mdd_raw $sl_cov i.zone (vi_group = prog_area  $sl_cov), cluster(groupid) 
eststo

ivprobit  mdd_bin $sl_cov i.zone (vi_group = prog_area  $sl_cov), vce(cluster groupid)
eststo

ivregress 2sls mahfp_16 $sl_cov i.zone (vi_group = prog_area  $sl_cov), cluster(groupid) 
eststo

ivregress 2sls mahfp_dif $sl_cov i.zone (vi_group = prog_area  $sl_cov), cluster(groupid) 
eststo

ivprobit mahfp_p_change $sl_cov i.zone (vi_group = prog_area  $sl_cov), vce(cluster groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\fs_2sls.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)


**examine zone specific differences

***outcome list: cop_stra cop_stra_bin sell_asset_bin mdd_raw mdd_bin mdd_grp_5 mahfp_16 mahfp_dif mahfp_p_change
eststo clear
 
reg cop_stra  samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_shock i.zone , cluster(groupid)
eststo
probit cop_stra_bin samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_shock i.zone , cluster(groupid)
eststo
probit sell_asset_bin samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_shock i.zone , cluster(groupid)
eststo
reg mdd_raw samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa $sl_cov i.zone , cluster(groupid)
eststo
probit mdd_bin samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
eststo
probit mdd_grp_5 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa $sl_cov i.zone , cluster(groupid)
eststo
reg mahfp_16 samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
eststo
reg mahfp_dif samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa $sl_cov i.zone , cluster(groupid)
eststo
reg mahfp_p_change samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa $sl_cov i.zone , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\fs_vsz_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

***implement Wald test to assess how different coefficients are

**cop_stra

eststo clear

reg cop_stra samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_shock i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg cop_stra samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_shock i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg cop_stra samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_shock i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg cop_stra samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_shock i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg cop_stra samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa $sl_cov_shock i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg cop_stra samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_shock i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 


**cop_stra_bin

eststo clear

probit cop_stra_bin samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_shock i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

probit cop_stra_bin samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_shock i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

probit cop_stra_bin samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_shock i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

probit cop_stra_bin samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_shock i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

probit cop_stra_bin samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_shock i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

probit cop_stra_bin samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_shock i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 


**sell_asset_bin

eststo clear

probit sell_asset_bin samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_shock i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

probit sell_asset_bin samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_shock i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

probit sell_asset_bin samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_shock i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

probit sell_asset_bin samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_shock i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

probit sell_asset_bin samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_shock i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

probit sell_asset_bin samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_shock i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 

**mdd_raw 

eststo clear

reg mdd_raw samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg mdd_raw samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg mdd_raw samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg mdd_raw samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg mdd_raw samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg mdd_raw samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 


**mdd_bin 

eststo clear

probit mdd_bin  samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

probit mdd_bin  samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

probit mdd_bin  samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

probit mdd_bin  samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

probit mdd_bin  samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

probit mdd_bin  samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 


**mdd_grp_5 

eststo clear

probit mdd_grp_5   samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

probit mdd_grp_5   samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

probit mdd_grp_5   samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

probit mdd_grp_5   samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

probit mdd_grp_5   samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

probit mdd_grp_5   samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 

**mahfp_16 

eststo clear

reg mahfp_16    samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg mahfp_16    samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg mahfp_16    samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg mahfp_16    samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg mahfp_16    samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg mahfp_16    samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 


**mahfp_dif 

eststo clear

reg mahfp_dif     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg mahfp_dif     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg mahfp_dif     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg mahfp_dif     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg mahfp_dif     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg mahfp_dif     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 


**mahfp_p_change

eststo clear

probit mahfp_p_change     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

probit mahfp_p_change     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

probit mahfp_p_change     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

probit mahfp_p_change     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

probit mahfp_p_change     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

probit mahfp_p_change     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 




***Differential effects -- Gender

**gen treatment dummies for female and male
g prog_area_f = (res_female==1 & prog_area==1)
g prog_area_m = (res_female==0 & prog_area==1)


**outcome variable list: cop_stra a_pca_07 cop_stra_bin a_pca_07_by_z sell_asset_bin mdd_raw mdd_bin mdd_grp_5 mahfp_16 mahfp_dif mahfp_p_change


**examine gender specific differences

eststo clear

reg cop_stra prog_area_f prog_area_m res_female   $sl_cov_shock i.zone  , cluster(groupid)
eststo

probit cop_stra_bin prog_area_f prog_area_m res_female  $sl_cov_shock i.zone  , cluster(groupid)
eststo

probit sell_asset_bin prog_area_f prog_area_m res_female   $sl_cov_shock i.zone  , cluster(groupid)
eststo

reg mdd_raw prog_area_f prog_area_m res_female  $sl_cov i.zone  , cluster(groupid)
eststo

probit mdd_bin prog_area_f prog_area_m res_female   $sl_cov i.zone  , cluster(groupid)
eststo

probit mdd_grp_5 prog_area_f prog_area_m res_female  $sl_cov i.zone  , cluster(groupid)
eststo

reg mahfp_16 prog_area_f prog_area_m res_female   $sl_cov i.zone  , cluster(groupid)
eststo

reg mahfp_dif prog_area_f prog_area_m res_female  $sl_cov i.zone  , cluster(groupid)
eststo

probit mahfp_p_change prog_area_f prog_area_m res_female  $sl_cov i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\fs_gen_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests for gender

***variables: cop_stra cop_stra_bin sell_asset_bin mdd_raw mdd_bin mdd_grp_5 mahfp_16 mahfp_dif mahfp_p_change

eststo clear

reg cop_stra prog_area_f prog_area_m res_female   $sl_cov_shock i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

probit cop_stra_bin prog_area_f prog_area_m res_female   $sl_cov_shock i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

probit sell_asset_bin prog_area_f prog_area_m res_female $sl_cov_shock i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg mdd_raw  prog_area_f prog_area_m res_female  $sl_cov i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


probit mdd_bin prog_area_f prog_area_m res_female   $sl_cov i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

probit mdd_grp_5 prog_area_f prog_area_m res_female  $sl_cov i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg mahfp_16 prog_area_f prog_area_m res_female   $sl_cov i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg mahfp_dif  prog_area_f prog_area_m res_female  $sl_cov i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

probit mahfp_p_change  prog_area_f prog_area_m res_female  $sl_cov i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store i

estout a b c d e f g h i,  stats(test test_prob) 



***Differential effects -- Sex of HH Head

**gen treatment dummies for female and male
g prog_area_f_h_h = (fem_headed==1 & prog_area==1)
g prog_area_m_h_h = (fem_headed==0 & prog_area==1)


eststo clear

reg cop_stra prog_area_f_h prog_area_m_h fem_headed   $sl_cov_shock i.zone  , cluster(groupid)
eststo

probit cop_stra_bin prog_area_f_h prog_area_m_h fem_headed  $sl_cov_shock i.zone  , cluster(groupid)
eststo

probit sell_asset_bin prog_area_f_h prog_area_m_h fem_headed  $sl_cov_shock i.zone  , cluster(groupid)
eststo

reg mdd_raw prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
eststo

probit mdd_bin prog_area_f_h prog_area_m_h fem_headed   $sl_cov i.zone  , cluster(groupid)
eststo

probit mdd_grp_5 prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
eststo

reg mahfp_16 prog_area_f_h prog_area_m_h fem_headed   $sl_cov i.zone  , cluster(groupid)
eststo

reg mahfp_dif prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
eststo

probit mahfp_p_change prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
eststo


esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\fs_fhh_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

***variables: cop_stra cop_stra_bin sell_asset_bin mdd_raw mdd_bin mdd_grp_5 mahfp_16 mahfp_dif mahfp_p_change

eststo clear

reg cop_stra prog_area_f_h prog_area_m_h fem_headed   $sl_cov_shock i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

probit cop_stra_bin prog_area_f_h prog_area_m_h fem_headed   $sl_cov_shock i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

probit sell_asset_bin prog_area_f_h prog_area_m_h fem_headed   $sl_cov_shock i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg mdd_raw  prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


probit mdd_bin prog_area_f_h prog_area_m_h fem_headed   $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

probit mdd_grp_5 prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg mahfp_16 prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg mahfp_dif  prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

probit mahfp_p_change prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store i

estout a b c d e f g h i,  stats(test test_prob) 



***Differential effects -- Education of respondent

**gen treatment dummies
g prog_area_8p_edu = (educat_res>7 & prog_area==1)
g prog_area_8u_edu = (educat_res<8 & prog_area==1)

g res_over_7_edu = (educat_res>7)


eststo clear

reg cop_stra prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov_shock i.zone  , cluster(groupid)
eststo

probit cop_stra_bin prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov_shock i.zone  , cluster(groupid)
eststo

probit sell_asset_bin prog_area_8p_edu prog_area_8u_edu res_over_7_edu   $sl_cov_shock i.zone  , cluster(groupid)
eststo

reg mdd_raw prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov i.zone  , cluster(groupid)
eststo

probit mdd_bin prog_area_8p_edu prog_area_8u_edu res_over_7_edu   $sl_cov i.zone  , cluster(groupid)
eststo

probit mdd_grp_5 prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov i.zone  , cluster(groupid)
eststo

reg mahfp_16 prog_area_8p_edu prog_area_8u_edu res_over_7_edu   $sl_cov i.zone  , cluster(groupid)
eststo

reg mahfp_dif prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov i.zone  , cluster(groupid)
eststo

reg mahfp_p_change prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\fs_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests for edu

***variables: cop_stra cop_stra_bin sell_asset_bin mdd_raw mdd_bin mdd_grp_5 mahfp_16 mahfp_dif mahfp_p_change

eststo clear

reg cop_stra prog_area_8p_edu prog_area_8u_edu res_over_7_edu   $sl_cov_shock i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

probit cop_stra_bin prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov_shock i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

probit sell_asset_bin prog_area_8p_edu prog_area_8u_edu res_over_7_edu   $sl_cov_shock i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg mdd_raw  prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


probit mdd_bin prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

probit mdd_grp_5 prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg mahfp_16 prog_area_8p_edu prog_area_8u_edu res_over_7_edu   $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg mahfp_dif  prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

probit mahfp_p_change  prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store i

estout a b c d e f g h i,  stats(test test_prob) 



***Differential effects -- Baseline Wealth

**gen treatment dummies 
xtile a_pca_07_by_z_bin =  a_pca_07_by_z , n(2)

g prog_area_asset_poor = (a_pca_07_by_z_bin==1 & prog_area==1)
g prog_area_asset_rich = (a_pca_07_by_z_bin==2 & prog_area==1)

g bl_asset_rich = (a_pca_07_by_z_bin==2)
g bl_asset_poor = (a_pca_07_by_z_bin==1)
**examine sub-group specific differences

eststo clear

reg cop_stra prog_area_asset_poor prog_area_asset_rich bl_asset_poor   $sl_cov_shock i.zone  , cluster(groupid)
eststo

probit cop_stra_bin prog_area_asset_poor prog_area_asset_rich bl_asset_poor   $sl_cov_shock i.zone  , cluster(groupid)
eststo

probit sell_asset_bin prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov_shock i.zone  , cluster(groupid)
eststo

reg mdd_raw prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov i.zone  , cluster(groupid)
eststo

probit mdd_bin prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov i.zone  , cluster(groupid)
eststo

probit mdd_grp_5 prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov i.zone  , cluster(groupid)
eststo

reg mahfp_16 prog_area_asset_poor prog_area_asset_rich bl_asset_poor   $sl_cov i.zone  , cluster(groupid)
eststo

reg mahfp_dif prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov i.zone  , cluster(groupid)
eststo

probit mahfp_p_change prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\asset_wealth_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

***variables: cop_stra cop_stra_bin sell_asset_bin mdd_raw mdd_bin mdd_grp_5 mahfp_16 mahfp_dif mahfp_p_change

eststo clear

reg cop_stra prog_area_asset_poor prog_area_asset_rich bl_asset_poor   $sl_cov_shock i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

probit cop_stra_bin prog_area_asset_poor prog_area_asset_rich bl_asset_poor   $sl_cov_shock i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

probit sell_asset_bin prog_area_asset_poor prog_area_asset_rich bl_asset_poor   $sl_cov_shock i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg mdd_raw  prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


probit mdd_bin prog_area_asset_poor prog_area_asset_rich bl_asset_poor   $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

probit mdd_grp_5 prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg mahfp_16 prog_area_asset_poor prog_area_asset_rich bl_asset_poor   $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg mahfp_dif  prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

probit mahfp_p_change  prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store i

estout a b c d e f g h i,  stats(test test_prob) 



***Differential effects -- Land Holding Size

**gen treatment dummies

g prog_area_land_u2 = (land_bl<2 & prog_area==1)
g prog_area_land_o2 = (land_b>=2 & prog_area==1)

g land_o2 = (land_b>=2)

**examine sub-group specific differences

eststo clear

reg cop_stra prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov_shock i.zone  , cluster(groupid)
eststo

probit cop_stra_bin prog_area_land_u2 prog_area_land_o2 land_o2   $sl_cov_shock i.zone  , cluster(groupid)
eststo

probit sell_asset_bin prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov_shock i.zone  , cluster(groupid)
eststo

reg mdd_raw prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
eststo

probit mdd_bin prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
eststo

probit mdd_grp_5 prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
eststo

reg mahfp_16 prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
eststo

reg mahfp_dif prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
eststo

probit mahfp_p_change prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\fs_land_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests for edu

***variables: cop_stra cop_stra_bin sell_asset_bin mdd_raw mdd_bin mdd_grp_5 mahfp_16 mahfp_dif

eststo clear

reg cop_stra prog_area_land_u2 prog_area_land_o2 land_o2   $sl_cov_shock i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

probit cop_stra_bin prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov_shock i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

probit sell_asset_bin prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov_shock i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg mdd_raw  prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


probit mdd_bin prog_area_land_u2 prog_area_land_o2 land_o2   $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

probit mdd_grp_5 prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg mahfp_16 prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg mahfp_dif  prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

probit mahfp_p_change  prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store i

estout a b c d e f g h i,  stats(test test_prob) 


***Differential effects -- Dairy Farmers

**gen treatment dummies

g prog_area_dar = (dar_prod==1 & prog_area==1)
g prog_area_no_dar = (dar_prod==0 & prog_area==1)

**examine sub-group specific differences

eststo clear

reg cop_stra prog_area_dar prog_area_no_dar dar_prod   $sl_cov_shock i.zone  , cluster(groupid)
eststo

probit cop_stra_bin prog_area_dar prog_area_no_dar dar_prod  $sl_cov_shock i.zone  , cluster(groupid)
eststo

probit sell_asset_bin prog_area_dar prog_area_no_dar dar_prod   $sl_cov_shock i.zone  , cluster(groupid)
eststo

reg mdd_raw prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
eststo

probit mdd_bin prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
eststo

probit mdd_grp_5 prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
eststo

reg mahfp_16 prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
eststo

reg mahfp_dif prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
eststo

probit mahfp_p_change prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\dar_fs_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

***variables: cop_stra cop_stra_bin sell_asset_bin mdd_raw mdd_bin mdd_grp_5 mahfp_16 mahfp_dif mahfp_p_change

eststo clear

reg cop_stra prog_area_dar prog_area_no_dar dar_prod   $sl_cov_shock i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

probit cop_stra_bin prog_area_dar prog_area_no_dar dar_prod  $sl_cov_shock i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

probit sell_asset_bin prog_area_dar prog_area_no_dar dar_prod   $sl_cov_shock i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg mdd_raw  prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


probit mdd_bin prog_area_dar prog_area_no_dar dar_prod   $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

probit mdd_grp_5 prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg mahfp_16 prog_area_dar prog_area_no_dar dar_prod   $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg mahfp_dif  prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

probit mahfp_p_change  prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store i

estout a b c d e f g h i,  stats(test test_prob) 



***Differential effects -- Official Position

**gen treatment dummies

g prog_area_OP = (official_role_res==1 & prog_area==1)
g prog_area_no_OP = (official_role_res==0 & prog_area==1)


**examine sub-group specific differences

eststo clear

reg cop_stra prog_area_OP prog_area_no_OP official_role  $sl_cov_shock i.zone  , cluster(groupid)
eststo

probit cop_stra_bin prog_area_OP prog_area_no_OP official_role   $sl_cov_shock i.zone  , cluster(groupid)
eststo

probit sell_asset_bin prog_area_OP prog_area_no_OP official_role   $sl_cov_shock i.zone  , cluster(groupid)
eststo

reg mdd_raw prog_area_OP prog_area_no_OP official_role  $sl_cov i.zone  , cluster(groupid)
eststo

probit mdd_bin prog_area_OP prog_area_no_OP official_role   $sl_cov i.zone  , cluster(groupid)
eststo

probit mdd_grp_5 prog_area_OP prog_area_no_OP official_role  $sl_cov i.zone  , cluster(groupid)
eststo

reg mahfp_16 prog_area_OP prog_area_no_OP official_role  $sl_cov i.zone  , cluster(groupid)
eststo

reg mahfp_dif prog_area_OP prog_area_no_OP official_role  $sl_cov i.zone  , cluster(groupid)
eststo

probit mahfp_p_change prog_area_OP prog_area_no_OP official_role  $sl_cov i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\fs_OP_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)


***variables: cop_stra cop_stra_bin sell_asset_bin mdd_raw mdd_bin mdd_grp_5 mahfp_16 mahfp_dif mahfp_p_change

eststo clear

reg cop_stra prog_area_OP prog_area_no_OP official_role   $sl_cov_shock i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

probit cop_stra_bin prog_area_OP prog_area_no_OP official_role  $sl_cov_shock i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

probit sell_asset_bin prog_area_OP prog_area_no_OP official_role    $sl_cov_shock i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg mdd_raw  prog_area_OP prog_area_no_OP official_role   $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


probit mdd_bin prog_area_OP prog_area_no_OP official_role   $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

probit mdd_grp_5 prog_area_OP prog_area_no_OP official_role   $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg mahfp_16 prog_area_OP prog_area_no_OP official_role   $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg mahfp_dif  prog_area_OP prog_area_no_OP official_role   $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

probit mahfp_p_change  prog_area_OP prog_area_no_OP official_role   $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store i

estout a b c d e f g h i,  stats(test test_prob) 



***Differential effects -- land self owned

**gen treatment dummies

g prog_area_l_self = (lnd_self_07_2==1 & prog_area==1)
g prog_area_l_oth = (lnd_self_07_2==0 & prog_area==1)


**examine sub-group specific differences

eststo clear

reg cop_stra prog_area_l_self prog_area_l_oth lnd_self_07_2  $sl_cov_shock i.zone  , cluster(groupid)
eststo

probit cop_stra_bin prog_area_l_self prog_area_l_oth lnd_self_07_2   $sl_cov_shock i.zone  , cluster(groupid)
eststo

probit sell_asset_bin prog_area_l_self prog_area_l_oth lnd_self_07_2   $sl_cov_shock i.zone  , cluster(groupid)
eststo

reg mdd_raw prog_area_l_self prog_area_l_oth lnd_self_07_2  $sl_cov i.zone  , cluster(groupid)
eststo

probit mdd_bin prog_area_l_self prog_area_l_oth lnd_self_07_2   $sl_cov i.zone  , cluster(groupid)
eststo

probit mdd_grp_5 prog_area_l_self prog_area_l_oth lnd_self_07_2  $sl_cov i.zone  , cluster(groupid)
eststo

reg mahfp_16 prog_area_l_self prog_area_l_oth lnd_self_07_2  $sl_cov i.zone  , cluster(groupid)
eststo

reg mahfp_dif prog_area_l_self prog_area_l_oth lnd_self_07_2  $sl_cov i.zone  , cluster(groupid)
eststo

probit mahfp_p_change prog_area_l_self prog_area_l_oth lnd_self_07_2  $sl_cov i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\fs_OP_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)


***variables: cop_stra cop_stra_bin sell_asset_bin mdd_raw mdd_bin mdd_grp_5 mahfp_16 mahfp_dif mahfp_p_change

eststo clear

reg cop_stra prog_area_l_self prog_area_l_oth lnd_self_07_2   $sl_cov_shock i.zone  , cluster(groupid)
test prog_area_l_self = prog_area_l_oth
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

probit cop_stra_bin prog_area_l_self prog_area_l_oth lnd_self_07_2  $sl_cov_shock i.zone  , cluster(groupid)
test prog_area_l_self = prog_area_l_oth
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

probit sell_asset_bin prog_area_l_self prog_area_l_oth lnd_self_07_2    $sl_cov_shock i.zone  , cluster(groupid)
test prog_area_l_self = prog_area_l_oth
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg mdd_raw  prog_area_l_self prog_area_l_oth lnd_self_07_2   $sl_cov i.zone  , cluster(groupid)
test prog_area_l_self = prog_area_l_oth
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d


probit mdd_bin prog_area_l_self prog_area_l_oth lnd_self_07_2   $sl_cov i.zone  , cluster(groupid)
test prog_area_l_self = prog_area_l_oth
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

probit mdd_grp_5 prog_area_l_self prog_area_l_oth lnd_self_07_2   $sl_cov i.zone  , cluster(groupid)
test prog_area_l_self = prog_area_l_oth
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg mahfp_16 prog_area_l_self prog_area_l_oth lnd_self_07_2   $sl_cov i.zone  , cluster(groupid)
test prog_area_l_self = prog_area_l_oth
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

reg mahfp_dif  prog_area_l_self prog_area_l_oth lnd_self_07_2   $sl_cov i.zone  , cluster(groupid)
test prog_area_l_self = prog_area_l_oth
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

probit mahfp_p_change  prog_area_l_self prog_area_l_oth lnd_self_07_2   $sl_cov i.zone  , cluster(groupid)
test prog_area_l_self = prog_area_l_oth
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store i

estout a b c d e f g h i,  stats(test test_prob) 




*================================================================================================
***Education progression, speding and economic ladder
*================================================================================================

**variables: edu_prog edu_prog_any edu_prog_all edu_spe edu_spe_log edu_spe_abv_med eco_lad eco_lad_1p

 
****Generate raw stats

eststo clear

local edu_var  edu_prog edu_prog_any edu_prog_all edu_spe edu_spe_log edu_spe_abv_med eco_lad eco_lad_1p

estpost tabstat `edu_var' , statistics(n mean) columns(statistics)
eststo

estpost tabstat `edu_var' if prog_area==1  , statistics(n mean) columns(statistics)
eststo

estpost tabstat `edu_var' if prog_area==0 , statistics(n mean) columns(statistics)
eststo
esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\edu_var_unaj_mean.csv", r  nogaps modelwidth(4) cells(mean(f(2))) 

**unajusted t-tests

eststo clear
local edu_var  edu_prog edu_prog_any edu_prog_all edu_spe edu_spe_log edu_spe_abv_med eco_lad eco_lad_1p
foreach var of local edu_var {
reg `var' prog_area , robust
eststo
}

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\edu_var_unaj_ttests.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



eststo clear

local edu_var  edu_prog edu_prog_any edu_prog_all edu_spe edu_spe_log edu_spe_abv_med eco_lad eco_lad_1p

estpost tabstat `edu_var', statistics(n median) columns(statistics)
eststo

estpost tabstat `edu_var' if prog_area==1, statistics(n median) columns(statistics)
eststo

estpost tabstat `edu_var' if prog_area==0, statistics(n median) columns(statistics)
eststo
esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\edu_var_unaj_median.csv", r  label nogaps modelwidth(4) cells(p50 (f(2))) 

**unajusted t-tests

eststo clear
local edu_var  edu_prog  edu_spe edu_spe_log  eco_lad 
foreach var of local edu_var {
qreg `var' prog_area
eststo
}

esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\edu_var_unaj_qreg.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



***OLS with clustered standard errors

**variables: edu_prog edu_prog_any edu_prog_all edu_spe edu_spe_log edu_spe_abv_med eco_lad eco_lad_1p

gl sl_cov_edu_pro "max_edu_hh soc_07_avg _hh_loc_altitude res_head res_employ r_tech_skill hh_lstock_07 elder_headed lnd_self_07_2"
gl sl_cov_edu_spe "num_child soc_07_avg _hh_loc_altitude hh_dist_tarma   res_female res_head res_spo_head res_farmer res_employ r_tech_skill hh_lstock_07 elder_headed hh_on_road lnd_self_07_2"

eststo clear

reg edu_prog prog_area ch_14_17_n $sl_cov_edu_pro i.zone , cluster(groupid)
eststo

probit edu_prog_any prog_area ch_14_17_n $sl_cov_edu_pro i.zone , cluster(groupid)
eststo

probit edu_prog_all  prog_area ch_14_17_n  $sl_cov_edu_pro i.zone, cluster(groupid)
eststo

reg edu_spe prog_area   $sl_cov_edu_spe i.zone, cluster(groupid)
eststo

reg edu_spe_log prog_area  $sl_cov_edu_spe i.zone , cluster(groupid)
eststo

probit edu_spe_abv_med prog_area pre_ce_log_pc_07  $sl_cov_edu_spe i.zone , cluster(groupid)
eststo

reg eco_lad prog_area   $sl_cov i.zone , cluster(groupid)
eststo

probit eco_lad_1p prog_area   $sl_cov i.zone , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\edu_ols.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



***IPWRA
**shortlist cov. correlated with Y

stepwise, pr (.1): reg edu_prog $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_edu_prog "`X'"

stepwise, pr (.1): probit edu_prog_any $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_edu_prog_any "`X'"

stepwise, pr (.1): probit edu_prog_all  $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_edu_prog_all  "`X'"

stepwise, pr (.1): reg edu_spe_log   $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_edu_spe_log  "`X'"

stepwise, pr (.1): probit edu_spe_abv_med   $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_edu_spe_abv_med  "`X'"

stepwise, pr (.1): reg eco_lad   $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_eco_lad  "`X'"

stepwise, pr (.1): probit eco_lad_1p  $all_cov samp_z_1  samp_z_3 samp_z_4 , r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_eco_lad_1p  "`X'"

eststo clear
teffects ipwra (edu_prog  $cov_edu_prog $sl_cov_pro i.zone) (prog_area  $sl_cov_edu_pro i.zone, probit), vce(r)
eststo
teffects ipwra (edu_prog_any $cov_edu_prog_any  $sl_cov_edu_pro i.zone, probit) (prog_area  $sl_cov_edu_pro i.zone, probit), vce(r)
eststo
teffects ipwra (edu_prog_all $cov_edu_prog_all  $sl_cov_edu_pro i.zone, probit) (prog_area  $sl_cov_edu_pro i.zone, probit), vce(r)
eststo

teffects ipwra (edu_spe_log $cov_edu_spe_log  $sl_cov_edu_spe i.zone) (prog_area  $sl_cov_edu_spe i.zone, probit), vce(r)
eststo
teffects ipwra (edu_spe_abv_med $cov_edu_spe_abv_med  $sl_cov_edu_spe i.zone, probit) (prog_area  $sl_cov_edu_spe i.zone, probit), vce(r)
eststo
teffects ipwra (eco_lad $cov_eco_lad  $sl_cov i.zone) (prog_area  $sl_cov i.zone, probit), vce(r)
eststo
teffects ipwra (eco_lad_1p $cov_eco_lad_1p $sl_cov i.zone, probit) (prog_area  $sl_cov i.zone, probit), vce(r)
eststo

esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\edu_ipwra.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)


***robust regression for continuous outcomes 

eststo clear

rreg edu_spe prog_area    $sl_cov_edu_spe i.zone
eststo

rreg edu_spe_log prog_area    $sl_cov_edu_spe i.zone
eststo


rreg eco_lad prog_area   $sl_cov i.zone 
eststo


esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\edu_rreg.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



***NN matching

**variables: edu_prog edu_prog_any edu_prog_all edu_spe edu_spe_log edu_spe_abv_med eco_lad eco_lad_1p

eststo clear

teffects nnmatch ( edu_prog  ch_14_17_n $sl_cov_edu_pro) (prog_area),  ematch(zone) biasadj( ch_14_17_n num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (edu_prog_any  ch_14_17_n $sl_cov_edu_pro) (prog_area),  ematch(zone) biasadj( ch_14_17_n num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (edu_prog_all ch_14_17_n $sl_cov_edu_pro) (prog_area),  ematch(zone) biasadj(ch_14_17_n num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (edu_spe $sl_cov_edu_spe) (prog_area),  ematch(zone) biasadj( num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (edu_spe_log $sl_cov_edu_spe) (prog_area),  ematch(zone) biasadj( num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (edu_spe_abv_med $sl_cov_edu_spe) (prog_area),  ematch(zone) biasadj(pre_ce_log_pc_07 num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (eco_lad $sl_cov) (prog_area),  ematch(zone) biasadj(num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo

teffects nnmatch (eco_lad_1p $sl_cov) (prog_area),  ematch(zone) biasadj(num_child max_edu_hh soc_07_avg hh_dist_tarma) 
eststo


esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\CE_nn.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



***quantile reg

eststo clear

qreg edu_spe prog_area   $sl_cov_edu_spe i.zone
eststo

qreg edu_spe_log prog_area   $sl_cov_edu_spe i.zone
eststo


qreg eco_lad prog_area   $sl_cov i.zone 
eststo


esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\edu_qreg.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**variables: edu_prog edu_prog_any edu_prog_all edu_spe edu_spe_log edu_spe_abv_med eco_lad eco_lad_1p


***2SLS
eststo clear

ivregress 2sls edu_prog ch_14_17_n $sl_cov_edu_pro i.zone (vi_group = prog_area ch_14_17_n $sl_cov_edu_pro), cluster(groupid) 
eststo

ivprobit edu_prog_any ch_14_17_n $sl_cov_edu_pro i.zone (vi_group = prog_area ch_14_17_n  $sl_cov_edu_pro), vce(cluster groupid) 
eststo

ivprobit edu_prog_all ch_14_17_n $sl_cov_edu_pro i.zone (vi_group = prog_area ch_14_17_n  $sl_cov_edu_pro), vce(cluster groupid) 
eststo

ivregress 2sls edu_spe  $sl_cov_edu_spe i.zone (vi_group = prog_area  $sl_cov_edu_spe), cluster(groupid) 
eststo

ivregress 2sls edu_spe_log  $sl_cov_edu_spe i.zone (vi_group = prog_area  $sl_cov_edu_spe), cluster(groupid) 
eststo

ivprobit edu_spe_abv_med  $sl_cov_edu_spe i.zone (vi_group = prog_area   $sl_cov_edu_spe), vce(cluster groupid) 
eststo

ivregress 2sls eco_lad  $sl_cov i.zone (vi_group = prog_area  $sl_cov), cluster(groupid) 
eststo

ivprobit eco_lad_1p  $sl_cov i.zone (vi_group = prog_area   $sl_cov), vce(cluster groupid) 
eststo


esttab using "C:\Users\khughes\Documents\Active projects\AFSPII\Analysis\estout tables\edu_2sls.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)


*examine zone specific differences

**variables: edu_prog edu_prog_any edu_prog_all edu_spe edu_spe_log edu_spe_abv_med eco_lad eco_lad_1p

eststo clear
 
reg edu_prog samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa ch_14_17_n $sl_cov_edu_pro i.zone , cluster(groupid)
eststo
probit edu_prog_any samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa ch_14_17_n $sl_cov_edu_pro i.zone , cluster(groupid)
eststo
probit edu_prog_all samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa ch_14_17_n $sl_cov_edu_pro i.zone , cluster(groupid)
eststo
reg edu_spe samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_edu_spe i.zone , cluster(groupid)
eststo
reg edu_spe_log samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_edu_spe i.zone , cluster(groupid)
eststo
probit edu_spe_abv_med samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_edu_spe i.zone , cluster(groupid)
eststo
reg eco_lad samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa   $sl_cov i.zone , cluster(groupid)
eststo
probit eco_lad_1p samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa $sl_cov i.zone , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\edu_vsz_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

***implement Wald test to assess how different coefficients are

**edu_prog

eststo clear

reg edu_prog samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa ch_14_17_n $sl_cov_edu_pro i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg edu_prog samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa ch_14_17_n $sl_cov_edu_pro i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg edu_prog samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa ch_14_17_n $sl_cov_edu_pro i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg edu_prog samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa ch_14_17_n $sl_cov_edu_pro i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg edu_prog samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa ch_14_17_n $sl_cov_edu_pro i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg edu_prog samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa ch_14_17_n $sl_cov_edu_pro i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 


**edu_prog_any

eststo clear

probit edu_prog_any samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa ch_14_17_n $sl_cov_edu_pro i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

probit edu_prog_any samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa ch_14_17_n $sl_cov_edu_pro i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

probit edu_prog_any samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa ch_14_17_n $sl_cov_edu_pro i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

probit edu_prog_any samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa ch_14_17_n $sl_cov_edu_pro i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

probit edu_prog_any samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa ch_14_17_n $sl_cov_edu_pro i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

probit edu_prog_any samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa ch_14_17_n $sl_cov_edu_pro i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 


**edu_prog_all

eststo clear

probit edu_prog_all samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa ch_14_17_n $sl_cov_edu_pro i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

probit edu_prog_all samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa ch_14_17_n $sl_cov_edu_pro i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

probit edu_prog_all samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa ch_14_17_n  $sl_cov_edu_pro i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

probit edu_prog_all samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa ch_14_17_n $sl_cov_edu_pro i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

probit edu_prog_all samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa ch_14_17_n $sl_cov_edu_pro i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

probit edu_prog_all samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa ch_14_17_n $sl_cov_edu_pro i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 

**edu_spe 

eststo clear

reg edu_spe samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_edu_spe i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg edu_spe samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_edu_spe i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg edu_spe samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_edu_spe i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg edu_spe samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_edu_spe i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg edu_spe samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_edu_spe i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg edu_spe samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_edu_spe i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 


**edu_spe_log 

eststo clear

reg edu_spe_log  samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_edu_spe i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg edu_spe_log  samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa   $sl_cov_edu_spe i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg edu_spe_log  samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_edu_spe i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg edu_spe_log  samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_edu_spe i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg edu_spe_log  samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_edu_spe i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg edu_spe_log  samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa $sl_cov_edu_spe i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 



**edu_spe_abv_med 

eststo clear

probit edu_spe_abv_med    samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_edu_spe i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

probit edu_spe_abv_med    samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_edu_spe i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

probit edu_spe_abv_med    samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_edu_spe i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

probit edu_spe_abv_med    samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_edu_spe i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

probit edu_spe_abv_med    samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_edu_spe i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

probit edu_spe_abv_med    samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov_edu_spe i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 


**eco_lad_1p 

eststo clear

reg eco_lad     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

reg eco_lad     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

reg eco_lad     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg eco_lad     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg eco_lad     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

reg eco_lad     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 

**eco_lad_1p 

eststo clear

probit eco_lad_1p     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_2_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

probit eco_lad_1p     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

probit eco_lad_1p     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_1_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

probit eco_lad_1p     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_3_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

probit eco_lad_1p     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_2_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

probit eco_lad_1p     samp_z_1_pa samp_z_2_pa samp_z_3_pa samp_z_4_pa  $sl_cov i.zone , cluster(groupid)
test samp_z_3_pa = samp_z_4_pa
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

estout a b c d e f,  stats(test test_prob) 



***Differential effects -- Gender

**gen treatment dummies for female and male
g prog_area_f = (res_female==1 & prog_area==1)
g prog_area_m = (res_female==0 & prog_area==1)


**examine gender specific differences

eststo clear

reg edu_prog prog_area_f prog_area_m res_female  ch_14_17_n $sl_cov_edu_pro i.zone  , cluster(groupid)
eststo

probit edu_prog_any prog_area_f prog_area_m res_female ch_14_17_n $sl_cov_edu_pro i.zone  , cluster(groupid)
eststo

probit edu_prog_all prog_area_f prog_area_m res_female  ch_14_17_n $sl_cov_edu_pro i.zone  , cluster(groupid)
eststo

reg edu_spe prog_area_f prog_area_m res_female  $sl_cov_edu_spe i.zone  , cluster(groupid)
eststo

reg edu_spe_log prog_area_f prog_area_m res_female   $sl_cov_edu_spe  i.zone  , cluster(groupid)
eststo

reg edu_spe_abv_med prog_area_f prog_area_m res_female   $sl_cov_edu_spe  i.zone  , cluster(groupid)
eststo

reg eco_lad prog_area_f prog_area_m res_female  $sl_cov i.zone  , cluster(groupid)
eststo

probit eco_lad_1p prog_area_f prog_area_m res_female  $sl_cov i.zone  , cluster(groupid)
eststo


esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\edu_gen_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)


**Wald tests for gender

***variables: edu_prog edu_prog_any edu_prog edu_prog_any edu_spe edu_spe_log edu_spe_abv_med eco_lad_1p lstock_dif_p

eststo clear

reg edu_prog prog_area_f prog_area_m res_female ch_14_17_n  $sl_cov_edu_pro i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

probit edu_prog_any prog_area_f prog_area_m res_female ch_14_17_n  $sl_cov_edu_pro i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

probit edu_prog_all prog_area_f prog_area_m res_female ch_14_17_n $sl_cov_pro  i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg edu_spe  prog_area_f prog_area_m res_female  $sl_cov_edu_spe i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg edu_spe_log prog_area_f prog_area_m res_female   $sl_cov_edu_spe i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

probit edu_spe_abv_med prog_area_f prog_area_m res_female   $sl_cov_edu_spe i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg eco_lad  prog_area_f prog_area_m res_female  $sl_cov i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

probit eco_lad_1p  prog_area_f prog_area_m res_female  $sl_cov i.zone  , cluster(groupid)
test prog_area_f = prog_area_m
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

estout a b c d e f g h,  stats(test test_prob) 




***Differential effects -- Sex of HH Head


**gen treatment dummies for female and male
g prog_area_f_h_h = (fem_headed==1 & prog_area==1)
g prog_area_m_h_h = (fem_headed==0 & prog_area==1)


eststo clear

reg edu_prog prog_area_f_h prog_area_m_h fem_headed  ch_14_17_n $sl_cov_edu_pro i.zone  , cluster(groupid)
eststo

probit edu_prog_any prog_area_f_h prog_area_m_h fem_headed ch_14_17_n  $sl_cov_edu_pro i.zone  , cluster(groupid)
eststo

probit edu_prog_all prog_area_f_h prog_area_m_h fem_headed ch_14_17_n $sl_cov_edu_pro i.zone  , cluster(groupid)
eststo

reg edu_spe prog_area_f_h prog_area_m_h fem_headed  $sl_cov_edu i.zone  , cluster(groupid)
eststo

reg edu_spe_log prog_area_f_h prog_area_m_h fem_headed  $sl_cov_edu i.zone  , cluster(groupid)
eststo

probit edu_spe_abv_med prog_area_f_h prog_area_m_h fem_headed   $sl_cov_edu i.zone  , cluster(groupid)
eststo

reg eco_lad prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
eststo

probit eco_lad_1p prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
eststo


esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\edu_fhh_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

***variables: edu_prog edu_prog_any edu_prog edu_prog_any edu_spe edu_spe_log edu_spe_abv_med eco_lad_1p lstock_dif_p

eststo clear

reg edu_prog prog_area_f_h prog_area_m_h fem_headed  ch_14_17_n $sl_cov_edu_pro i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

probit edu_prog_any prog_area_f_h prog_area_m_h fem_headed ch_14_17_n  $sl_cov_edu_pro i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

probit edu_prog_all prog_area_f_h prog_area_m_h fem_headed ch_14_17_n $sl_cov_edu_pro i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg edu_spe  prog_area_f_h prog_area_m_h fem_headed  $sl_cov_edu_spe i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg edu_spe_log prog_area_f_h prog_area_m_h fem_headed   $sl_cov_edu_spe i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

probit edu_spe_abv_med prog_area_f_h prog_area_m_h fem_headed  $sl_cov_edu_spe i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg eco_lad  prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

probit eco_lad_1p  prog_area_f_h prog_area_m_h fem_headed  $sl_cov i.zone  , cluster(groupid)
test prog_area_f_h = prog_area_m_h
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h


estout a b c d e f g h,  stats(test test_prob) 



***Differential effects -- Education of respondent

**gen treatment dummies
g prog_area_8p_edu = (educat_res>7 & prog_area==1)
g prog_area_8u_edu = (educat_res<8 & prog_area==1)

g res_over_7_edu = (educat_res>7)

***variables: edu_prog edu_prog_any edu_prog edu_prog_any edu_spe edu_spe_log edu_spe_abv_med eco_lad_1p lstock_dif_p

eststo clear

reg edu_prog prog_area_8p_edu prog_area_8u_edu res_over_7_edu  ch_14_17_n $sl_cov_edu_pro i.zone  , cluster(groupid)
eststo

probit edu_prog_any prog_area_8p_edu prog_area_8u_edu res_over_7_edu ch_14_17_n $sl_cov_edu_pro i.zone  , cluster(groupid)
eststo

probit edu_prog_all prog_area_8p_edu prog_area_8u_edu res_over_7_edu ch_14_17_n  $sl_cov_edu_pro i.zone  , cluster(groupid)
eststo

reg edu_spe prog_area_8p_edu prog_area_8u_edu res_over_7_edu   $sl_cov_edu_spe i.zone  , cluster(groupid)
eststo

reg edu_spe_log prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov_edu_spe i.zone  , cluster(groupid)
eststo

probit edu_spe_abv_med prog_area_8p_edu prog_area_8u_edu res_over_7_edu   $sl_cov_edu_spe i.zone  , cluster(groupid)
eststo

reg eco_lad prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov i.zone  , cluster(groupid)
eststo

probit eco_lad_1p prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\edu_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests for edu

***variables: edu_prog edu_prog_any edu_prog edu_prog_any edu_spe edu_spe_log edu_spe_abv_med eco_lad_1p 

eststo clear

reg edu_prog prog_area_8p_edu prog_area_8u_edu res_over_7_edu ch_14_17_n  $sl_cov_edu_pro i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

probit edu_prog_any prog_area_8p_edu prog_area_8u_edu res_over_7_edu  ch_14_17_n $sl_cov_edu_pro i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

probit edu_prog_all  prog_area_8p_edu prog_area_8u_edu res_over_7_edu ch_14_17_n $sl_cov_edu_pro i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg edu_spe prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov_edu_spe i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg edu_spe_log prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov_edu_spe i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

probit edu_spe_abv_med prog_area_8p_edu prog_area_8u_edu res_over_7_edu   $sl_cov_edu_spe i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg eco_lad  prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

probit eco_lad_1p  prog_area_8p_edu prog_area_8u_edu res_over_7_edu  $sl_cov i.zone  , cluster(groupid)
test prog_area_8p_edu = prog_area_8u_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

estout a b c d e f g h,  stats(test test_prob) 



***Differential effects -- Baseline Wealth

**gen treatment dummies 

xtile a_pca_07_bin_edu = a_pca_07 if edu_prog !=.,n(2) 

g prog_area_asset_poor_edu = (a_pca_07_bin_edu==1 & prog_area==1)
g prog_area_asset_rich_edu = (a_pca_07_bin_edu==2 & prog_area==1)

g bl_asset_rich_edu = (a_pca_07_bin_edu==2)
g bl_asset_poor_edu = (a_pca_07_bin_edu==1)

***variables: edu_prog edu_prog_any edu_prog edu_prog_any edu_spe edu_spe_log edu_spe_abv_med eco_lad_1p 

**examine sub-group specific differences

eststo clear

reg edu_prog prog_area_asset_poor_edu prog_area_asset_rich_edu bl_asset_poor_edu ch_14_17_n $sl_cov_edu_pro i.zone  , cluster(groupid)
eststo

probit edu_prog_any prog_area_asset_poor_edu prog_area_asset_rich_edu bl_asset_poor_edu ch_14_17_n $sl_cov_edu_pro i.zone  , cluster(groupid)
eststo

probit edu_prog_all prog_area_asset_poor_edu prog_area_asset_rich_edu bl_asset_poor_edu ch_14_17_n $sl_cov_edu_pro i.zone  , cluster(groupid)
eststo

reg edu_spe prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov_edu_spe i.zone  , cluster(groupid)
eststo

reg edu_spe_log prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov_edu_spe i.zone  , cluster(groupid)
eststo

probit edu_spe_abv_med prog_area_asset_poor prog_area_asset_rich bl_asset_poor   $sl_cov_edu_spe i.zone  , cluster(groupid)
eststo

reg eco_lad prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov i.zone  , cluster(groupid)
eststo

probit eco_lad_1p prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\edu_wealth_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

***variables: edu_prog edu_prog_any edu_prog edu_prog_any edu_spe edu_spe_log edu_spe_abv_med eco_lad_1p 

eststo clear

reg edu_prog prog_area_asset_poor_edu prog_area_asset_rich_edu bl_asset_poor_edu ch_14_17_n  $sl_cov_edu_pro i.zone  , cluster(groupid)
test prog_area_asset_poor_edu = prog_area_asset_rich_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

probit edu_prog_any prog_area_asset_poor_edu prog_area_asset_rich_edu bl_asset_poor_edu ch_14_17_n  $sl_cov_edu_pro i.zone  , cluster(groupid)
test prog_area_asset_poor_edu = prog_area_asset_rich_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

probit edu_prog_all prog_area_asset_poor_edu prog_area_asset_rich_edu bl_asset_poor_edu  ch_14_17_n $sl_cov_edu_pro i.zone  , cluster(groupid)
test prog_area_asset_poor_edu = prog_area_asset_rich_edu
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg edu_spe prog_area_asset_poor prog_area_asset_rich bl_asset_poor   $sl_cov_edu_spe i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg edu_spe_log prog_area_asset_poor prog_area_asset_rich bl_asset_poor $sl_cov_edu_spe i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

probit edu_spe_abv_med prog_area_asset_poor prog_area_asset_rich bl_asset_poor   $sl_cov_spe i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg eco_lad  prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

probit eco_lad_1p  prog_area_asset_poor prog_area_asset_rich bl_asset_poor  $sl_cov i.zone  , cluster(groupid)
test prog_area_asset_poor = prog_area_asset_rich
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h


estout a b c d e f g h,  stats(test test_prob) 



***Differential effects -- Land Holding Size

**gen treatment dummies

g prog_area_land_u2 = (land_bl<2 & prog_area==1)
g prog_area_land_o2 = (land_b>=2 & prog_area==1)

g land_o2 = (land_b>=2)

***variables: edu_prog edu_prog_any edu_prog edu_prog_any edu_spe edu_spe_log edu_spe_abv_med eco_lad_1p 

**examine sub-group specific differences

eststo clear

reg edu_prog prog_area_land_u2 prog_area_land_o2 land_o2 ch_14_17_n $sl_cov_edu_pro i.zone  , cluster(groupid)
eststo

probit edu_prog_any prog_area_land_u2 prog_area_land_o2 land_o2 ch_14_17_n  $sl_cov_edu_pro  i.zone  , cluster(groupid)
eststo

probit edu_prog_all prog_area_land_u2 prog_area_land_o2 land_o2 ch_14_17_n $sl_cov_edu_pro  i.zone  , cluster(groupid)
eststo

reg edu_spe prog_area_land_u2 prog_area_land_o2 land_o2 $sl_cov_edu_spe i.zone  , cluster(groupid)
eststo

reg edu_spe_log prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov_edu_spe i.zone  , cluster(groupid)
eststo

probit edu_spe_abv_med prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov_edu_spe i.zone  , cluster(groupid)
eststo

reg eco_lad prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
eststo

probit eco_lad_1p prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\edu_land_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests for edu

***variables: edu_prog edu_prog_any edu_prog edu_prog_any edu_spe edu_spe_log edu_spe_abv_med eco_lad_1p

eststo clear

reg edu_prog prog_area_land_u2 prog_area_land_o2 land_o2  ch_14_17_n $sl_cov_edu_pro i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

probit edu_prog_any prog_area_land_u2 prog_area_land_o2 land_o2 ch_14_17_n $sl_cov_edu_pro i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

probit edu_prog_all prog_area_land_u2 prog_area_land_o2 land_o2 ch_14_17_n $sl_cov_edu_pro i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg edu_spe prog_area_land_u2 prog_area_land_o2 land_o2   $sl_cov_edu_spe i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg edu_spe_log prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov_edu_spe i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

probit edu_spe_abv_med prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov_edu_spe i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg eco_lad  prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

probit eco_lad_1p  prog_area_land_u2 prog_area_land_o2 land_o2  $sl_cov i.zone  , cluster(groupid)
test prog_area_land_u2 = prog_area_land_o2
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

estout a b c d e f g h,  stats(test test_prob) 


***Differential effects -- Dairy Farmers

**gen treatment dummies

g prog_area_dar = (dar_prod==1 & prog_area==1)
g prog_area_no_dar = (dar_prod==0 & prog_area==1)

**examine sub-group specific differences

***variables: edu_prog edu_prog_any edu_prog edu_prog_any edu_spe edu_spe_log edu_spe_abv_med eco_lad_1p 


eststo clear

reg edu_prog prog_area_dar prog_area_no_dar dar_prod ch_14_17_n $sl_cov_edu_pro i.zone  , cluster(groupid)
eststo

probit edu_prog_any prog_area_dar prog_area_no_dar dar_prod ch_14_17_n $sl_cov_edu_pro i.zone  , cluster(groupid)
eststo

probit edu_prog_all prog_area_dar prog_area_no_dar dar_prod  ch_14_17_n  $sl_cov_edu_pro i.zone  , cluster(groupid)
eststo

reg edu_spe prog_area_dar prog_area_no_dar dar_prod $sl_cov_edu_spe  i.zone  , cluster(groupid)
eststo

reg edu_spe_log prog_area_dar prog_area_no_dar dar_prod $sl_cov_edu_spe  i.zone  , cluster(groupid)
eststo

probit edu_spe_abv_med prog_area_dar prog_area_no_dar dar_prod $sl_cov_edu_spe  i.zone  , cluster(groupid)
eststo

reg eco_lad prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
eststo

probit eco_lad_1p prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
eststo


esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\dar_edu_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

***variables: edu_prog edu_prog_any edu_prog edu_prog_any edu_spe edu_spe_log edu_spe_abv_med eco_lad_1p 

eststo clear

reg edu_prog prog_area_dar prog_area_no_dar dar_prod ch_14_17_n $sl_cov_edu_prog i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

probit edu_prog_any prog_area_dar prog_area_no_dar dar_prod ch_14_17_n $sl_cov_edu_prog i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

probit edu_prog_all prog_area_dar prog_area_no_dar dar_prod ch_14_17_n  $sl_cov_edu_prog i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg edu_spe prog_area_dar prog_area_no_dar dar_prod   $sl_cov_edu_spe i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg edu_spe_log prog_area_dar prog_area_no_dar dar_prod  $sl_cov_edu_spe i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

probit edu_spe_abv_med prog_area_dar prog_area_no_dar dar_prod   $sl_cov_edu_spe i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg eco_lad  prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

probit eco_lad_1p  prog_area_dar prog_area_no_dar dar_prod  $sl_cov i.zone  , cluster(groupid)
test prog_area_dar = prog_area_no_dar
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h

estout a b c d e f g h ,  stats(test test_prob) 



***Differential effects -- Official Position

**gen treatment dummies

g prog_area_OP = (official_role_res==1 & prog_area==1)
g prog_area_no_OP = (official_role_res==0 & prog_area==1)


**examine sub-group specific differences

***variables: edu_prog edu_prog_any edu_prog edu_prog_any edu_spe edu_spe_log edu_spe_abv_med eco_lad_1p

eststo clear

reg edu_prog prog_area_OP prog_area_no_OP official_role ch_14_17_n  $sl_cov_edu_pro i.zone  , cluster(groupid)
eststo

probit edu_prog_any prog_area_OP prog_area_no_OP official_role ch_14_17_n  $sl_cov_edu_pro i.zone  , cluster(groupid)
eststo

probit edu_prog_all prog_area_OP prog_area_no_OP official_role ch_14_17_n $sl_cov_edu_pro i.zone  , cluster(groupid)
eststo

reg edu_spe prog_area_OP prog_area_no_OP official_role  $sl_cov_edu_spe i.zone  , cluster(groupid)
eststo

reg edu_spe_log prog_area_OP prog_area_no_OP official_role  $sl_cov_edu_spe i.zone  , cluster(groupid)
eststo

probit edu_spe_abv_med prog_area_OP prog_area_no_OP official_role  $sl_cov_edu_spe i.zone  , cluster(groupid)
eststo

reg eco_lad prog_area_OP prog_area_no_OP official_role  $sl_cov i.zone  , cluster(groupid)
eststo

reg eco_lad_1p prog_area_OP prog_area_no_OP official_role  $sl_cov i.zone  , cluster(groupid)
eststo


esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\edu_OP_dif_effect.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

**Wald tests 

***variables: edu_prog edu_prog_any edu_prog edu_prog_any edu_spe edu_spe_log edu_spe_abv_med eco_lad_1p

eststo clear

reg edu_prog prog_area_OP prog_area_no_OP official_role ch_14_17_n  $sl_cov_edu_pro i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store a

probit edu_prog_any prog_area_OP prog_area_no_OP official_role ch_14_17_n  $sl_cov_edu_pro i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store b

probit edu_prog_all prog_area_OP prog_area_no_OP official_role  ch_14_17_n $sl_cov_edu_pro i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store c

reg edu_spe prog_area_OP prog_area_no_OP official_role   $sl_cov_edu_spe i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store d

reg edu_spe_log prog_area_OP prog_area_no_OP official_role  $sl_cov_edu_spe i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store e

probit edu_spe_abv_med prog_area_OP prog_area_no_OP official_role  $sl_cov_edu_spe i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store f

reg eco_lad  prog_area_OP prog_area_no_OP official_role  $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store g

probit eco_lad_1p  prog_area_OP prog_area_no_OP official_role  $sl_cov i.zone  , cluster(groupid)
test prog_area_OP = prog_area_no_OP
local test = r(F)
local test_prob = r(p)
estadd scalar test = `test'
estadd scalar test_prob = `test_prob'
estimates store h


estout a b c d e f g h,  stats(test test_prob) 


****Generate level variable for graph
g edu_prog_lev = 1 if edu_prog==0
replace edu_prog_lev = 2 if edu_prog > 0 & edu_prog < 1
replace edu_prog_lev = 3 if edu_prog ==1



*====================================================================================================================
****Interrogate Mechanisms
*====================================================================================================================

***retrieve original OLS coefficients for asset outcome variables 

eststo clear

reg dif_pre_ce_pc prog_area $sl_cov i.zone  , cluster(groupid)
eststo

reg a_pca_16 prog_area a_pca_07  $sl_cov i.zone  , cluster(groupid)
eststo

reg a_pca_p_dif_2 prog_area  $sl_cov i.zone  , cluster(groupid)
eststo

dprobit sell_asset_bin prog_area $sl_cov_shock samp_z_1 samp_z_2 samp_z_3   , cluster(groupid)
eststo


esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\asset_measures_OLS.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)

***women only

gl sl_cov_f "max_edu_hh  soc_07_avg _hh_loc_altitude res_married res_widow res_head hh_lstock_07 hh_emp_07 hh_on_road lnd_self_07_2   "

gl sl_cov_shock_f "res_married res_widow res_head hh_lstock_07 hh_bus_07 lnd_self_07_2 soc_07_avg _hh_loc_altitude"

eststo clear

reg dif_pre_ce_pc prog_area $sl_cov_f i.zone if res_female==1 , cluster(groupid)
eststo

reg a_pca_16 prog_area a_pca_07  $sl_cov_f i.zone if res_female==1  , cluster(groupid)
eststo

reg a_pca_p_dif_2 prog_area  $sl_cov_f i.zone if res_female==1  , cluster(groupid)
eststo

dprobit sell_asset_bin prog_area $sl_cov_shock_f samp_z_1 samp_z_2 samp_z_3  if res_female==1  , cluster(groupid)
eststo


esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\asset_measures_OLS_f.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



***OLS Coefficients upon controlling for AF-Index

eststo clear

reg dif_pre_ce_pc prog_area af_ind_dif $sl_cov i.zone  , cluster(groupid)
eststo

reg a_pca_16 prog_area a_pca_07 af_ind_dif $sl_cov i.zone  , cluster(groupid)
eststo

reg a_pca_p_dif_2 prog_area af_ind_dif $sl_cov i.zone  , cluster(groupid)
eststo

dprobit sell_asset_bin prog_area af_ind_dif $sl_cov_shock samp_z_1 samp_z_2 samp_z_3  , cluster(groupid)
eststo


esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\asset_measures_OLS_af_ind.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)


***women only


eststo clear

reg dif_pre_ce_pc prog_area af_ind_dif $sl_cov_f i.zone if res_female==1 , cluster(groupid)
eststo

reg a_pca_16 prog_area a_pca_07 af_ind_dif $sl_cov_f i.zone if res_female==1  , cluster(groupid)
eststo

reg a_pca_p_dif_2 prog_area af_ind_dif $sl_cov_f i.zone if res_female==1  , cluster(groupid)
eststo

dprobit sell_asset_bin prog_area af_ind_dif $sl_cov_shock_f samp_z_1 samp_z_2 samp_z_3 if res_female==1  , cluster(groupid)
eststo


esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\asset_measures_OLS_f_af_ind_dif.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)


***control for SALM and microenterprise only

g fin_bus_ind_dif = (fin_bus_ind_16-fin_bus_ind_07)


eststo clear

reg dif_pre_ce_pc prog_area salm_ind_dif fin_bus_ind_dif $sl_cov i.zone  , cluster(groupid)
eststo

reg a_pca_16 prog_area a_pca_07 salm_ind_dif fin_bus_ind_dif $sl_cov i.zone  , cluster(groupid)
eststo

reg a_pca_p_dif_2 prog_area salm_ind_dif fin_bus_ind_dif $sl_cov i.zone  , cluster(groupid)
eststo

dprobit sell_asset_bin prog_area salm_ind_dif fin_bus_ind_dif $sl_cov_shock samp_z_1 samp_z_2 samp_z_3  , cluster(groupid)
eststo


esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\asset_measures_OLS_other_expl.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)


***women only


eststo clear

reg dif_pre_ce_pc prog_area salm_ind_dif fin_bus_ind_dif $sl_cov_f i.zone if res_female==1 , cluster(groupid)
eststo

reg a_pca_16 prog_area a_pca_07 salm_ind_dif fin_bus_ind_dif $sl_cov_f i.zone if res_female==1  , cluster(groupid)
eststo

reg a_pca_p_dif_2 prog_area salm_ind_dif fin_bus_ind_dif $sl_cov_f i.zone if res_female==1  , cluster(groupid)
eststo

dprobit sell_asset_bin prog_area salm_ind_dif fin_bus_ind_dif $sl_cov_shock_f samp_z_1 samp_z_2 samp_z_3 if res_female==1  , cluster(groupid)
eststo


esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\asset_measures_OLS_f_salm_ind_dif fin_bus_ind_dif.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



**mediation analysis
global all_cov_2: subinstr global all_cov  "a_pca_07" ""
global all_cov_2: subinstr global all_cov_2 "pre_ce_07" ""
global all_cov_2: subinstr global all_cov_2 "official_role_res" ""

set more off
stepwise, pr (.1): reg af_ind_dif $all_cov_2, r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_af_ind_dif "`X'"


sem (af_ind_dif <- prog_area  $sl_cov samp_z_1 samp_z_2 samp_z_3 ) (dif_pre_ce_pc <- af_ind_dif prog_area $sl_cov $cov_af_ind_dif samp_z_1 samp_z_2 samp_z_3 ) , vce(cluster groupid) nocapslatent
estat teffects

sem (af_ind_dif <- prog_area  $sl_cov samp_z_1 samp_z_2 samp_z_3 ) (a_pca_16 <- af_ind_dif prog_area a_pca_07 $sl_cov $cov_af_ind_dif samp_z_1 samp_z_2 samp_z_3 ) , vce(cluster groupid) nocapslatent
estat teffects

sem (af_ind_dif <- prog_area  $sl_cov samp_z_1 samp_z_2 samp_z_3 ) (a_pca_p_dif_2  <- af_ind_dif prog_area $sl_cov $cov_af_ind_dif samp_z_1 samp_z_2 samp_z_3 ) , vce(cluster groupid) nocapslatent
estat teffects

sem (af_ind_dif <- prog_area  $sl_cov_shock samp_z_1 samp_z_2 samp_z_3 ) (sell_asset_bin <- af_ind_dif prog_area $sl_cov_shock $cov_af_ind_dif samp_z_1 samp_z_2 samp_z_3 ) , vce(cluster groupid) nocapslatent
estat teffects


**female
set more off
stepwise, pr (.1): reg af_ind_dif $all_cov_2 if res_female==1, r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_af_ind_dif_f "`X'"


sem (af_ind_dif <- prog_area  $sl_cov_f samp_z_1 samp_z_2 samp_z_3 ) (dif_pre_ce_pc <- af_ind_dif prog_area $sl_cov_f $cov_af_ind_dif_f samp_z_1 samp_z_2 samp_z_3 ) if res_female==1 , vce(cluster groupid) nocapslatent
estat teffects

sem (af_ind_dif <- prog_area  $sl_cov_f samp_z_1 samp_z_2 samp_z_3 ) (a_pca_16 <- af_ind_dif prog_area a_pca_07 $sl_cov_f $cov_af_ind_dif_f samp_z_1 samp_z_2 samp_z_3 )  if res_female==1 , vce(cluster groupid) nocapslatent
estat teffects

sem (af_ind_dif <- prog_area  $sl_cov_f samp_z_1 samp_z_2 samp_z_3 ) (a_pca_p_dif_2  <- af_ind_dif prog_area $sl_cov_f $cov_af_ind_dif_f samp_z_1 samp_z_2 samp_z_3 )  if res_female==1 , vce(cluster groupid) nocapslatent
estat teffects

sem (af_ind_dif <- prog_area  $sl_cov_shock_f samp_z_1 samp_z_2 samp_z_3 ) (sell_asset_bin <- af_ind_dif prog_area $sl_cov_shock_f $cov_af_ind_dif_f samp_z_1 samp_z_2 samp_z_3 )  if res_female==1 , vce(cluster groupid) nocapslatent
estat teffects



******Trees


***OLS Coefficients upon controlling for trees

eststo clear

reg dif_pre_ce_pc prog_area trees_avg_dif $sl_cov i.zone  , cluster(groupid)
eststo

reg a_pca_16 prog_area a_pca_07 trees_avg_dif $sl_cov i.zone  , cluster(groupid)
eststo

reg a_pca_p_dif_2 prog_area trees_avg_dif $sl_cov i.zone  , cluster(groupid)
eststo

dprobit sell_asset_bin prog_area trees_avg_dif $sl_cov_shock samp_z_1 samp_z_2 samp_z_3  , cluster(groupid)
eststo


esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\asset_measures_OLS_trees.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)


***women only


eststo clear

reg dif_pre_ce_pc prog_area trees_avg_dif $sl_cov_f i.zone if res_female==1 , cluster(groupid)
eststo

reg a_pca_16 prog_area a_pca_07 trees_avg_dif $sl_cov_f i.zone if res_female==1  , cluster(groupid)
eststo

reg a_pca_p_dif_2 prog_area trees_avg_dif $sl_cov_f i.zone if res_female==1  , cluster(groupid)
eststo

dprobit sell_asset_bin prog_area trees_avg_dif $sl_cov_shock_f samp_z_1 samp_z_2 samp_z_3 if res_female==1  , cluster(groupid)
eststo


esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\asset_measures_OLS_f_trees_avg_dif.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)


**mediation analysis

set more off
stepwise, pr (.1): reg trees_avg_dif $all_cov_2, r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_trees_avg_dif "`X'"


sem (trees_avg_dif <- prog_area  $sl_cov samp_z_1 samp_z_2 samp_z_3 ) (dif_pre_ce_pc <- trees_avg_dif prog_area $sl_cov $cov_trees_avg_dif samp_z_1 samp_z_2 samp_z_3 ) , vce(cluster groupid) nocapslatent
estat teffects

sem (trees_avg_dif <- prog_area  $sl_cov samp_z_1 samp_z_2 samp_z_3 ) (a_pca_16 <- trees_avg_dif prog_area a_pca_07 $sl_cov $cov_trees_avg_dif samp_z_1 samp_z_2 samp_z_3 ) , vce(cluster groupid) nocapslatent
estat teffects

sem (trees_avg_dif <- prog_area  $sl_cov samp_z_1 samp_z_2 samp_z_3 ) (a_pca_p_dif_2  <- trees_avg_dif prog_area $sl_cov $cov_trees_avg_dif samp_z_1 samp_z_2 samp_z_3 ) , vce(cluster groupid) nocapslatent
estat teffects

sem (trees_avg_dif <- prog_area  $sl_cov_shock samp_z_1 samp_z_2 samp_z_3 ) (sell_asset_bin <- trees_avg_dif prog_area $sl_cov_shock $cov_trees_avg_dif samp_z_1 samp_z_2 samp_z_3 ) , vce(cluster groupid) nocapslatent
estat teffects


**female
set more off
stepwise, pr (.1): reg trees_avg_dif $all_cov_2 if res_female==1, r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_trees_avg_dif_f "`X'"


sem (trees_avg_dif <- prog_area  $sl_cov_f samp_z_1 samp_z_2 samp_z_3 ) (dif_pre_ce_pc <- trees_avg_dif prog_area $sl_cov_f $cov_trees_avg_dif_f samp_z_1 samp_z_2 samp_z_3 ) if res_female==1 , vce(cluster groupid) nocapslatent
estat teffects

sem (trees_avg_dif <- prog_area  $sl_cov_f samp_z_1 samp_z_2 samp_z_3 ) (a_pca_16 <- trees_avg_dif prog_area a_pca_07 $sl_cov_f $cov_trees_avg_dif_f samp_z_1 samp_z_2 samp_z_3 )  if res_female==1 , vce(cluster groupid) nocapslatent
estat teffects

sem (trees_avg_dif <- prog_area  $sl_cov_f samp_z_1 samp_z_2 samp_z_3 ) (a_pca_p_dif_2  <- trees_avg_dif prog_area $sl_cov_f $cov_trees_avg_dif_f samp_z_1 samp_z_2 samp_z_3 )  if res_female==1 , vce(cluster groupid) nocapslatent
estat teffects

sem (trees_avg_dif <- prog_area  $sl_cov_shock_f samp_z_1 samp_z_2 samp_z_3 ) (sell_asset_bin <- trees_avg_dif prog_area $sl_cov_shock_f $cov_trees_avg_dif_f samp_z_1 samp_z_2 samp_z_3 )  if res_female==1 , vce(cluster groupid) nocapslatent
estat teffects


******AF Index + Trees

***OLS Coefficients upon controlling for trees

eststo clear

reg dif_pre_ce_pc prog_area trees_avg_dif af_ind_dif $sl_cov i.zone  , cluster(groupid)
eststo

reg a_pca_16 prog_area a_pca_07 trees_avg_dif af_ind_dif $sl_cov i.zone  , cluster(groupid)
eststo

reg a_pca_p_dif_2 prog_area trees_avg_dif af_ind_dif $sl_cov i.zone  , cluster(groupid)
eststo

dprobit sell_asset_bin prog_area trees_avg_dif af_ind_dif $sl_cov_shock samp_z_1 samp_z_2 samp_z_3  , cluster(groupid)
eststo


esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\asset_measures_OLS_trees_AFindex.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)


***women only


eststo clear

reg dif_pre_ce_pc prog_area trees_avg_dif af_ind_dif $sl_cov_f i.zone if res_female==1 , cluster(groupid)
eststo

reg a_pca_16 prog_area a_pca_07 trees_avg_dif af_ind_dif $sl_cov_f i.zone if res_female==1  , cluster(groupid)
eststo

reg a_pca_p_dif_2 prog_area trees_avg_dif af_ind_dif $sl_cov_f i.zone if res_female==1  , cluster(groupid)
eststo

dprobit sell_asset_bin prog_area trees_avg_dif af_ind_dif $sl_cov_shock_f samp_z_1 samp_z_2 samp_z_3 if res_female==1  , cluster(groupid)
eststo


esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\asset_measures_OLS_f_trees_avg_dif_AF_index.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)


***mediation analysis
sem (af_ind_dif <- prog_area  $sl_cov $cov_trees_avg_dif $cov_af_ind_dif samp_z_1 samp_z_2 samp_z_3 ) ( trees_avg_dif <- prog_area  $sl_cov $cov_trees_avg_dif $cov_af_ind_dif samp_z_1 samp_z_2 samp_z_3 ) (dif_pre_ce_pc <- af_ind_dif trees_avg_dif prog_area $sl_cov $cov_trees_avg_dif $cov_af_ind_dif samp_z_1 samp_z_2 samp_z_3 ) , vce(cluster groupid) nocapslatent cov(e.af_ind_dif*e.trees_avg_dif)
estat teffects

sem (af_ind_dif <- prog_area  $sl_cov $cov_trees_avg_dif $cov_af_ind_dif a_pca_07 samp_z_1 samp_z_2 samp_z_3 ) ( trees_avg_dif <- prog_area  a_pca_07 $sl_cov $cov_trees_avg_dif $cov_af_ind_dif samp_z_1 samp_z_2 samp_z_3 ) (a_pca_16 <- af_ind_dif trees_avg_dif prog_area a_pca_07 $sl_cov $cov_trees_avg_dif $cov_af_ind_dif samp_z_1 samp_z_2 samp_z_3 ) , vce(cluster groupid) nocapslatent cov(e.af_ind_dif*e.trees_avg_dif)
estat teffects


sem (af_ind_dif <- prog_area  $sl_cov $cov_trees_avg_dif $cov_af_ind_dif samp_z_1 samp_z_2 samp_z_3 ) ( trees_avg_dif <- prog_area  $sl_cov $cov_trees_avg_dif $cov_af_ind_dif samp_z_1 samp_z_2 samp_z_3 ) (a_pca_p_dif_2  <- af_ind_dif trees_avg_dif prog_area $sl_cov $cov_trees_avg_dif $cov_af_ind_dif samp_z_1 samp_z_2 samp_z_3 ) , vce(cluster groupid) nocapslatent cov(e.af_ind_dif*e.trees_avg_dif)
estat teffects

sem (af_ind_dif <- prog_area  $sl_cov $cov_trees_avg_dif $cov_af_ind_dif samp_z_1 samp_z_2 samp_z_3 ) ( trees_avg_dif <- prog_area  $sl_cov $cov_trees_avg_dif $cov_af_ind_dif samp_z_1 samp_z_2 samp_z_3 ) (sell_asset_bin  <- af_ind_dif trees_avg_dif prog_area $sl_cov $cov_trees_avg_dif $cov_af_ind_dif samp_z_1 samp_z_2 samp_z_3 ) , vce(cluster groupid) nocapslatent cov(e.af_ind_dif*e.trees_avg_dif)
estat teffects



**female
sem (af_ind_dif <- prog_area    $sl_cov_f $cov_trees_avg_dif_f $cov_af_ind_dif_f samp_z_1 samp_z_2 samp_z_3 ) ( trees_avg_dif <- prog_area   $sl_cov_f $cov_trees_avg_dif_f $cov_af_ind_dif_f samp_z_1 samp_z_2 samp_z_3 ) (dif_pre_ce_pc <- af_ind_dif trees_avg_dif prog_area $sl_cov_f $cov_trees_avg_dif_f $cov_af_ind_dif_f samp_z_1 samp_z_2 samp_z_3 )  if res_female==1, vce(cluster groupid) nocapslatent cov(e.af_ind_dif*e.trees_avg_dif)
estat teffects

sem (af_ind_dif <- prog_area  $sl_cov_f $cov_trees_avg_dif_f $cov_af_ind_dif_f a_pca_07 samp_z_1 samp_z_2 samp_z_3 ) ( trees_avg_dif <- prog_area  a_pca_07 $sl_cov_f $cov_trees_avg_dif_f $cov_af_ind_dif_f samp_z_1 samp_z_2 samp_z_3 ) (a_pca_16 <- af_ind_dif trees_avg_dif prog_area a_pca_07 $sl_cov_f $cov_trees_avg_dif_f $cov_af_ind_dif_f samp_z_1 samp_z_2 samp_z_3 ) if res_female==1, vce(cluster groupid) nocapslatent cov(e.af_ind_dif*e.trees_avg_dif)
estat teffects



sem (af_ind_dif <- prog_area  $sl_cov_f $cov_trees_avg_dif_f $cov_af_ind_dif_f samp_z_1 samp_z_2 samp_z_3 ) ( trees_avg_dif <- prog_area  $sl_cov_f $cov_trees_avg_dif_f $cov_af_ind_dif_f samp_z_1 samp_z_2 samp_z_3 ) (a_pca_p_dif_2  <- af_ind_dif trees_avg_dif prog_area $sl_cov_f $cov_trees_avg_dif_f $cov_af_ind_dif_f samp_z_1 samp_z_2 samp_z_3 ) if res_female==1, vce(cluster groupid) nocapslatent  cov(e.af_ind_dif*e.trees_avg_dif)
estat teffects

sem (af_ind_dif <- prog_area  $sl_cov_f $cov_trees_avg_dif_f $cov_af_ind_dif_f samp_z_1 samp_z_2 samp_z_3 ) ( trees_avg_dif <- prog_area  $sl_cov_f $cov_trees_avg_dif_f $cov_af_ind_dif_f samp_z_1 samp_z_2 samp_z_3 ) (sell_asset_bin  <- af_ind_dif trees_avg_dif prog_area $sl_cov_f $cov_trees_avg_dif_f $cov_af_ind_dif_f samp_z_1 samp_z_2 samp_z_3 ) if res_female==1, vce(cluster groupid) nocapslatent cov(e.af_ind_dif*e.trees_avg_dif)
estat teffects



*****Look at local average effect among those who adopted
	

g af_adopt_bin = (af_ind_dif>.2 | trees_avg_dif >=10 ) if af_ind_dif !=. & trees_avg_dif !=.

g af_adopt_sig = 1 if prog_area==1 &  af_adopt_bin==0
replace af_adopt_sig = 2 if prog_area==1 &  af_adopt_bin==1
replace af_adopt_sig = 3  if prog_area==0 &  af_adopt_bin==0
replace af_adopt_sig = 4  if prog_area==0 &  af_adopt_bin==1



**OLS controlling for all observables 


g prog_area_af = prog_area
replace prog_area_af = . if af_adopt_bin == 0 & prog_area==1

g prog_area_n_af = prog_area
replace prog_area_n_af = . if af_adopt_bin == 1 & prog_area==1

eststo clear
reg dif_pre_ce_pc prog_area_af salm_ind_dif fin_bus_ind_dif $all_cov_2 i.zone , cluster(groupid) 
eststo

reg a_pca_16   prog_area_af a_pca_07 salm_ind_dif fin_bus_ind_dif $all_cov_2 i.zone , cluster(groupid) 
eststo

reg a_pca_p_dif_2  prog_area_af salm_ind_dif fin_bus_ind_dif $all_cov_2 i.zone , cluster(groupid) 
eststo

reg dif_pre_ce_pc prog_area_af salm_ind_dif fin_bus_ind_dif $all_cov_2 i.zone if res_female==1 , cluster(groupid) 
eststo

reg a_pca_16  prog_area_af a_pca_07 salm_ind_dif fin_bus_ind_dif $all_cov_2 i.zone  if res_female==1 , cluster(groupid) 
eststo

reg a_pca_p_dif_2  prog_area_af salm_ind_dif fin_bus_ind_dif $all_cov_2 i.zone  if res_female==1 , cluster(groupid) 
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\asset_measures_OLS_adopt sig.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



eststo clear
reg dif_pre_ce_pc prog_area_n_af salm_ind_dif fin_bus_ind_dif $all_cov_2 i.zone , cluster(groupid) 
eststo

reg a_pca_16   prog_area_n_af a_pca_07 salm_ind_dif fin_bus_ind_dif $all_cov_2 i.zone , cluster(groupid) 
eststo

reg a_pca_p_dif_2  prog_area_n_af salm_ind_dif fin_bus_ind_dif $all_cov_2 i.zone , cluster(groupid) 
eststo

reg dif_pre_ce_pc prog_area_n_af salm_ind_dif fin_bus_ind_dif $all_cov_2 i.zone if res_female==1 , cluster(groupid) 
eststo

reg a_pca_16 prog_area_n_af a_pca_07 salm_ind_dif fin_bus_ind_dif $all_cov_2 i.zone  if res_female==1 , cluster(groupid) 
eststo

reg a_pca_p_dif_2  prog_area_n_af salm_ind_dif fin_bus_ind_dif $all_cov_2 i.zone  if res_female==1 , cluster(groupid) 
eststo


esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\asset_measures_OLS_adopt insig.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)





***OLS with control functions

recode af_adopt_bin (0=1) (1=0), gen (af_no_adopt_bin)

probit af_adopt_bin $all_cov i.zone , robust
predict zg_tr if e(sample), xb
g phi_tr =normalden(zg_tr)
g PHI_tr =normal(zg_tr)
g CF_adopt=phi_tr /PHI_tr
drop phi_tr
drop PHI_tr
drop zg_tr

probit af_no_adopt_bin $all_cov, robust
predict zg_tr if e(sample), xb
g phi_tr =normalden(zg_tr)
g PHI_tr =normal(zg_tr)
g CF_no_adopt=phi_tr /PHI_tr
drop phi_tr
drop PHI_tr
drop zg_tr

g af_ind_dif_r = af_ind_dif * -1

reg af_ind_dif $all_cov i.zone , robust
predict zg_tr if e(sample), xb
g phi_tr =normalden(zg_tr)
g PHI_tr =normal(zg_tr)
g CF_af_ind=phi_tr /PHI_tr
drop phi_tr
drop PHI_tr
drop zg_tr

reg af_ind_dif_r $all_cov, robust
predict zg_tr if e(sample), xb
g phi_tr =normalden(zg_tr)
g PHI_tr =normal(zg_tr)
g CF_af_ind_r=phi_tr /PHI_tr
drop phi_tr
drop PHI_tr
drop zg_tr




eststo clear
reg dif_pre_ce_pc prog_area_af salm_ind_dif fin_bus_ind_dif $all_cov_2 CF_adopt CF_no_adopt i.zone , cluster(groupid) 
eststo

reg a_pca_16   prog_area_af a_pca_07 salm_ind_dif fin_bus_ind_dif $all_cov_2 CF_adopt CF_no_adopt i.zone , cluster(groupid) 
eststo

reg a_pca_p_dif_2  prog_area_af salm_ind_dif fin_bus_ind_dif $all_cov_2 CF_adopt CF_no_adopt i.zone , cluster(groupid) 
eststo

reg dif_pre_ce_pc prog_area_af salm_ind_dif fin_bus_ind_dif $all_cov_2 CF_adopt CF_no_adopt i.zone if res_female==1 , cluster(groupid) 
eststo

reg a_pca_16   prog_area_af a_pca_07 salm_ind_dif fin_bus_ind_dif $all_cov_2 CF_adopt CF_no_adopt i.zone  if res_female==1 , cluster(groupid) 
eststo

reg a_pca_p_dif_2  prog_area_af salm_ind_dif fin_bus_ind_dif $all_cov_2 CF_adopt CF_no_adopt i.zone  if res_female==1 , cluster(groupid) 
eststo


esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\asset_measures_OLS_adopt sig_CF.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)


eststo clear
reg dif_pre_ce_pc prog_area_n_af salm_ind_dif fin_bus_ind_dif $all_cov_2 CF_af_ind CF_af_ind_r i.zone , cluster(groupid) 
eststo

reg a_pca_16   prog_area_n_af a_pca_07 salm_ind_dif fin_bus_ind_dif $all_cov_2 CF_af_ind CF_af_ind_r i.zone , cluster(groupid) 
eststo

reg a_pca_p_dif_2  prog_area_n_af salm_ind_dif fin_bus_ind_dif $all_cov_2 CF_af_ind CF_af_ind_r i.zone , cluster(groupid) 
eststo

reg dif_pre_ce_pc prog_area_n_af salm_ind_dif fin_bus_ind_dif $all_cov_2 CF_af_ind CF_af_ind_r i.zone if res_female==1 , cluster(groupid) 
eststo

reg a_pca_16   prog_area_n_af a_pca_07 salm_ind_dif fin_bus_ind_dif $all_cov_2 CF_af_ind CF_af_ind_r i.zone  if res_female==1 , cluster(groupid) 
eststo

reg a_pca_p_dif_2  prog_area_n_af salm_ind_dif fin_bus_ind_dif $all_cov_2 CF_af_ind CF_af_ind_r i.zone  if res_female==1 , cluster(groupid) 
eststo


esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\asset_measures_OLS_low_adopt_CF.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



eststo clear
ivregress 2sls dif_pre_ce_pc $sl_cov i.zone (af_adopt_bin = prog_area $sl_cov ), cluster(groupid) 
eststo

ivregress 2sls a_pca_16 a_pca_07 $sl_cov  i.zone (af_adopt_bin = prog_area a_pca_07 $sl_cov ), cluster(groupid) 
eststo

ivregress 2sls a_pca_p_dif_2 $sl_cov i.zone (af_adopt_bin = prog_area  $sl_cov), cluster(groupid) 
eststo

ivregress 2sls dif_pre_ce_pc $sl_cov_f i.zone (af_adopt_bin = prog_area  $sl_cov_f) if res_female==1, cluster(groupid) 
eststo

ivregress 2sls a_pca_16 a_pca_07 $sl_cov_f  i.zone (af_adopt_bin = prog_area a_pca_07  $sl_cov_f) if res_female==1, cluster(groupid) 
eststo

ivregress 2sls a_pca_p_dif_2 $sl_cov_f i.zone (af_adopt_bin = prog_area  $sl_cov_f) if res_female==1, cluster(groupid) 
eststo


esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\asset_measures_2SLS_adopt sig.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)


eststo clear
ivregress 2sls dif_pre_ce_pc $sl_cov i.zone (af_ind_dif  = prog_area  ), cluster(groupid) 
eststo

ivregress 2sls a_pca_16 a_pca_07 $sl_cov  i.zone (af_ind_dif = prog_area a_pca_07 ), cluster(groupid) 
eststo

ivregress 2sls a_pca_p_dif_2 $sl_cov i.zone (af_ind_dif = prog_area  $sl_cov), cluster(groupid) 
eststo


ivregress 2sls dif_pre_ce_pc $sl_cov_f i.zone (af_ind_dif = prog_area  $sl_cov_f) if res_female==1, cluster(groupid) 
eststo

ivregress 2sls a_pca_16 a_pca_07 $sl_cov_f  i.zone (af_ind_dif = prog_area a_pca_07  $sl_cov_f) if res_female==1, cluster(groupid) 
eststo

ivregress 2sls a_pca_p_dif_2 $sl_cov_f i.zone (af_ind_dif = prog_area  $sl_cov_f) if res_female==1, cluster(groupid) 
eststo


esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\asset_measures_2SLS_af_dif.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



eststo clear
ivregress 2sls dif_pre_ce_pc $sl_cov i.zone (trees_avg_dif = prog_area ), cluster(groupid) 
eststo

ivregress 2sls a_pca_16 a_pca_07 $sl_cov  i.zone (trees_avg_dif = prog_area a_pca_07 ), cluster(groupid) 
eststo

ivregress 2sls a_pca_p_dif_2 $sl_cov i.zone (trees_avg_dif = prog_area  $sl_cov), cluster(groupid) 
eststo


ivregress 2sls dif_pre_ce_pc $sl_cov_f i.zone (trees_avg_dif = prog_area  $sl_cov_f) if res_female==1, cluster(groupid) 
eststo

ivregress 2sls a_pca_16 a_pca_07 $sl_cov_f  i.zone (trees_avg_dif = prog_area a_pca_07  $sl_cov_f) if res_female==1, cluster(groupid) 
eststo

ivregress 2sls a_pca_p_dif_2 $sl_cov_f i.zone (trees_avg_dif = prog_area  $sl_cov_f) if res_female==1, cluster(groupid) 
eststo


esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\asset_measures_2SLS_trees_ind.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)


****mediation analysis af_adoption-->af production income and/or milk yields-->asset accumulation  

***first put af_prod_sale if on 10 point scale

xtile af_prod_xtile = af_prod_sale_dif, n(20)
tab af_prod_xtile
replace af_prod_xtile = 3 if af_prod_xtile==14
replace af_prod_xtile = 4 if af_prod_xtile==15
replace af_prod_xtile = 5 if af_prod_xtile==16
replace af_prod_xtile = 6 if af_prod_xtile==17
replace af_prod_xtile = 8 if af_prod_xtile==18
replace af_prod_xtile = 9 if af_prod_xtile==19
replace af_prod_xtile = 10 if af_prod_xtile==20


set more off
stepwise, pr (.1): reg af_prod_xtile $all_cov_2, r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_af_prod_sale_dif"`X'"


sem (samp_z_1 samp_z_2 samp_z_3 $cov_af_prod_sale_dif  $sl_cov  $cov_af_ind_dif  prog_area -> af_ind_dif  ) (samp_z_1 samp_z_2 samp_z_3 $cov_af_prod_sale_dif  $sl_cov  $cov_af_ind_dif  prog_area -> af_prod_xtile ) (samp_z_1 samp_z_2 samp_z_3 $cov_af_prod_sale_dif   $cov_af_ind_dif  prog_area -> dif_pre_ce_pc  ) (samp_z_1 samp_z_2 samp_z_3 $cov_af_prod_sale_dif  $sl_cov  $cov_af_ind_dif af_ind_dif  -> dif_pre_ce_pc ) (samp_z_1 samp_z_2 samp_z_3 $sl_cov $cov_af_prod_sale_dif   $cov_af_ind_dif af_ind_dif  -> af_prod_xtile) (samp_z_1 samp_z_2 samp_z_3 $cov_af_prod_sale_dif  $sl_cov  $cov_af_ind_dif af_prod_xtile -> dif_pre_ce_pc ), vce(cluster groupid) nocapslatent 
estat teffects

sem (samp_z_1 samp_z_2 samp_z_3 a_pca_07 $cov_af_prod_sale_dif  $sl_cov  $cov_af_ind_dif  prog_area -> af_ind_dif  ) (samp_z_1 samp_z_2 samp_z_3 a_pca_07 $cov_af_prod_sale_dif  $sl_cov  $cov_af_ind_dif  prog_area -> af_prod_xtile ) (samp_z_1 samp_z_2 samp_z_3 a_pca_07 $cov_af_prod_sale_dif   $cov_af_ind_dif  prog_area -> a_pca_16  ) (samp_z_1 samp_z_2 samp_z_3 a_pca_07 $cov_af_prod_sale_dif  $sl_cov  $cov_af_ind_dif af_ind_dif  -> a_pca_16 ) (samp_z_1 samp_z_2 samp_z_3 a_pca_07 $sl_cov $cov_af_prod_sale_dif   $cov_af_ind_dif af_ind_dif  -> af_prod_xtile) (samp_z_1 samp_z_2 samp_z_3 a_pca_07 $cov_af_prod_sale_dif  $sl_cov  $cov_af_ind_dif af_prod_xtile -> a_pca_16 ), vce(cluster groupid) nocapslatent 
estat teffects

sem (samp_z_1 samp_z_2 samp_z_3 $cov_af_prod_sale_dif  $sl_cov  $cov_af_ind_dif  prog_area -> af_ind_dif  ) (samp_z_1 samp_z_2 samp_z_3 $cov_af_prod_sale_dif  $sl_cov  $cov_af_ind_dif  prog_area -> af_prod_xtile ) (samp_z_1 samp_z_2 samp_z_3 $cov_af_prod_sale_dif   $cov_af_ind_dif  prog_area -> a_pca_p_dif_2 ) (samp_z_1 samp_z_2 samp_z_3 $cov_af_prod_sale_dif  $sl_cov  $cov_af_ind_dif af_ind_dif  -> a_pca_p_dif_2) (samp_z_1 samp_z_2 samp_z_3 $sl_cov $cov_af_prod_sale_dif   $cov_af_ind_dif af_ind_dif  -> af_prod_xtile) (samp_z_1 samp_z_2 samp_z_3 $cov_af_prod_sale_dif  $sl_cov  $cov_af_ind_dif af_prod_xtile -> a_pca_p_dif_2 ), vce(cluster groupid) nocapslatent 
estat teffects

sem (samp_z_1 samp_z_2 samp_z_3 $all_cov  prog_area -> af_ind_dif  ) (samp_z_1 samp_z_2 samp_z_3 $all_cov prog_area -> af_prod_xtile ) (samp_z_1 samp_z_2 samp_z_3 $all_cov  prog_area -> sell_asset_bin ) (samp_z_1 samp_z_2 samp_z_3 $all_cov af_ind_dif  -> sell_asset_bin) (samp_z_1 samp_z_2 samp_z_3 $all_cov af_ind_dif  -> af_prod_xtile) (samp_z_1 samp_z_2 samp_z_3 $all_cov af_prod_xtile -> sell_asset_bin ), vce(cluster groupid) nocapslatent 
estat teffects


***Female respondents

set more off
stepwise, pr (.1): reg af_prod_xtile $all_cov_2 if res_female==1, r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_af_prod_sale_dif_f"`X'"


global all_cov_f: subinstr global all_cov  "res_female" ""


sem (samp_z_1 samp_z_2 samp_z_3 $cov_af_prod_sale_dif_f  $sl_cov_f  $cov_af_ind_dif_f  prog_area -> af_ind_dif  ) (samp_z_1 samp_z_2 samp_z_3 $cov_af_prod_sale_dif_f  $sl_cov_f  $cov_af_ind_dif_f   prog_area -> af_prod_xtile ) (samp_z_1 samp_z_2 samp_z_3 $cov_af_prod_sale_dif_f   $cov_af_ind_dif_f  prog_area -> dif_pre_ce_pc  ) (samp_z_1 samp_z_2 samp_z_3 $cov_af_prod_sale_dif_f  $sl_cov_f  $cov_af_ind_dif_f  af_ind_dif  -> dif_pre_ce_pc ) (samp_z_1 samp_z_2 samp_z_3 $sl_cov_f $cov_af_prod_sale_dif_f   $cov_af_ind_dif_f af_ind_dif  -> af_prod_xtile) (samp_z_1 samp_z_2 samp_z_3 $cov_af_prod_sale_dif_f  $sl_cov_f  $cov_af_ind_dif_f  af_prod_xtile -> dif_pre_ce_pc ) if res_female==1, vce(cluster groupid) nocapslatent 
estat teffects

sem (samp_z_1 samp_z_2 samp_z_3 a_pca_07 $cov_af_prod_sale_dif_f  $sl_cov_f  $cov_af_ind_dif_f   prog_area -> af_ind_dif  ) (samp_z_1 samp_z_2 samp_z_3 a_pca_07 $cov_af_prod_sale_dif_f  $sl_cov_f  $cov_af_ind_dif_f   prog_area -> af_prod_xtile ) (samp_z_1 samp_z_2 samp_z_3 a_pca_07 $cov_af_prod_sale_dif_f   $cov_af_ind_dif_f  prog_area -> a_pca_16  ) (samp_z_1 samp_z_2 samp_z_3 a_pca_07 $cov_af_prod_sale_dif_f  $sl_cov_f  $cov_af_ind_dif_f  af_ind_dif  -> a_pca_16 ) (samp_z_1 samp_z_2 samp_z_3 a_pca_07 $sl_cov_f $cov_af_prod_sale_dif_f   $cov_af_ind_dif_f af_ind_dif  -> af_prod_xtile) (samp_z_1 samp_z_2 samp_z_3 a_pca_07 $cov_af_prod_sale_dif_f  $sl_cov_f  $cov_af_ind_dif_f  af_prod_xtile -> a_pca_16 ) if res_female==1, vce(cluster groupid) nocapslatent 
estat teffects

sem (samp_z_1 samp_z_2 samp_z_3 $cov_af_prod_sale_dif_f  $sl_cov_f  $cov_af_ind_dif_f   prog_area -> af_ind_dif  ) (samp_z_1 samp_z_2 samp_z_3 $cov_af_prod_sale_dif_f  $sl_cov_f  $cov_af_ind_dif_f   prog_area -> af_prod_xtile ) (samp_z_1 samp_z_2 samp_z_3 $cov_af_prod_sale_dif_f   $cov_af_ind_dif_f  prog_area -> a_pca_p_dif_2 ) (samp_z_1 samp_z_2 samp_z_3 $cov_af_prod_sale_dif_f  $sl_cov_f  $cov_af_ind_dif_f  af_ind_dif  -> a_pca_p_dif_2) (samp_z_1 samp_z_2 samp_z_3 $sl_cov_f $cov_af_prod_sale_dif_f   $cov_af_ind_dif_f af_ind_dif  -> af_prod_xtile) (samp_z_1 samp_z_2 samp_z_3 $cov_af_prod_sale_dif_f  $sl_cov_f  $cov_af_ind_dif_f  af_prod_xtile -> a_pca_p_dif_2 ) if res_female==1, vce(cluster groupid) nocapslatent 
estat teffects

sem (samp_z_1 samp_z_2 samp_z_3 $all_cov_f  prog_area -> af_ind_dif  ) (samp_z_1 samp_z_2 samp_z_3 $all_cov_f prog_area -> af_prod_xtile ) (samp_z_1 samp_z_2 samp_z_3 $all_cov_f  prog_area -> sell_asset_bin ) (samp_z_1 samp_z_2 samp_z_3 $all_cov_f af_ind_dif  -> sell_asset_bin) (samp_z_1 samp_z_2 samp_z_3 $all_cov_f af_ind_dif  -> af_prod_xtile) (samp_z_1 samp_z_2 samp_z_3 $all_cov_f af_prod_xtile -> sell_asset_bin )if res_female==1, vce(cluster groupid) nocapslatent 
estat teffects



******Dar producers

sem (samp_z_1 samp_z_2 samp_z_3 $all_cov_2  prog_area -> af_ind_dif  ) (samp_z_1 samp_z_2 samp_z_3 $all_cov_2 prog_area -> cow_milk_p_ch ) (samp_z_1 samp_z_2 samp_z_3 $all_cov_2  prog_area -> a_pca_p_dif_2 ) (samp_z_1 samp_z_2 samp_z_3 $all_cov_2 af_ind_dif  -> a_pca_p_dif_2) (samp_z_1 samp_z_2 samp_z_3 $all_cov_2 af_ind_dif  -> cow_milk_p_ch) (samp_z_1 samp_z_2 samp_z_3 $all_cov_2 cow_milk_p_ch -> a_pca_p_dif_2 ) if dar_prod==1 & avg_dif_milk_y_cow !=., vce(cluster groupid) nocapslatent 
estat teffects

sem (samp_z_1 samp_z_2 samp_z_3 $all_cov_2  prog_area -> tree_fod_dif ) (samp_z_1 samp_z_2 samp_z_3 $all_cov_2 prog_area -> cow_milk_p_ch) (samp_z_1 samp_z_2 samp_z_3 $all_cov_2  prog_area -> a_pca_p_dif_2 ) (samp_z_1 samp_z_2 samp_z_3 $all_cov_2 tree_fod_dif  -> a_pca_p_dif_2) (samp_z_1 samp_z_2 samp_z_3 $all_cov_2 tree_fod_dif  -> cow_milk_p_ch) (samp_z_1 samp_z_2 samp_z_3 $all_cov_2 cow_milk_p_ch -> a_pca_p_dif_2 ) if dar_prod==1 & avg_dif_milk_y_cow !=., vce(cluster groupid) nocapslatent 
estat teffects

sem (samp_z_1 samp_z_2 samp_z_3 $all_cov_2  prog_area -> tree_fod_inc ) (samp_z_1 samp_z_2 samp_z_3 $all_cov_2 prog_area -> milk_yield_change_pos) (samp_z_1 samp_z_2 samp_z_3 $all_cov_2  prog_area -> a_pca_p_dif_2 ) (samp_z_1 samp_z_2 samp_z_3 $all_cov_2 tree_fod_inc  -> a_pca_p_dif_2) (samp_z_1 samp_z_2 samp_z_3 $all_cov_2 tree_fod_inc  -> milk_yield_change_pos) (samp_z_1 samp_z_2 samp_z_3 $all_cov_2 milk_yield_change_pos -> a_pca_p_dif_2 ) if dar_prod==1 & avg_dif_milk_y_cow !=., vce(cluster groupid) nocapslatent 
estat teffects

sem (samp_z_1 samp_z_2 samp_z_3 $all_cov_2  prog_area -> af_ind_dif  ) (samp_z_1 samp_z_2 samp_z_3 $all_cov_2 prog_area -> cow_milk_p_ch ) (samp_z_1 samp_z_2 samp_z_3 $all_cov_2  prog_area -> a_pca_p_dif_2 ) (samp_z_1 samp_z_2 samp_z_3 $all_cov_2 af_ind_dif  -> a_pca_p_dif_2) (samp_z_1 samp_z_2 samp_z_3 $all_cov_2 af_ind_dif  -> cow_milk_p_ch) (samp_z_1 samp_z_2 samp_z_3 $all_cov_2 cow_milk_p_ch -> a_pca_p_dif_2 ) if dar_prod==1 & avg_dif_milk_y_cow !=., vce(cluster groupid) nocapslatent 
estat teffects

sem (samp_z_1 samp_z_2 samp_z_3 $all_cov_2  prog_area -> tree_fod_dif ) (samp_z_1 samp_z_2 samp_z_3 $all_cov_2 prog_area -> cow_milk_p_ch) (samp_z_1 samp_z_2 samp_z_3 $all_cov_2  prog_area -> a_pca_p_dif_2 ) (samp_z_1 samp_z_2 samp_z_3 $all_cov_2 tree_fod_dif  -> a_pca_p_dif_2) (samp_z_1 samp_z_2 samp_z_3 $all_cov_2 tree_fod_dif  -> cow_milk_p_ch) (samp_z_1 samp_z_2 samp_z_3 $all_cov_2 cow_milk_p_ch -> a_pca_p_dif_2 ) if dar_prod==1 & avg_dif_milk_y_cow !=., vce(cluster groupid) nocapslatent 
estat teffects


******soc

global all_cov_2: subinstr global all_cov  "a_pca_07" ""
global all_cov_2: subinstr global all_cov_2 "pre_ce_07" ""
global all_cov_2: subinstr global all_cov_2 "official_role_res" ""
global all_cov_2: subinstr global all_cov_2 "soc_07_avg" ""


eststo clear

reg dif_pre_ce_pc soc_avg_dif  $all_cov_2 i.zone  , r
eststo

reg dif_pre_ce_pc soc_avg_dif  $all_cov_2 if zone==1 , r
eststo

reg dif_pre_ce_pc soc_avg_dif  $all_cov_2 if zone==2 , r
eststo

reg dif_pre_ce_pc soc_avg_dif  $all_cov_2 if zone==3 , r
eststo

reg dif_pre_ce_pc soc_avg_dif  $all_cov_2 if zone==4 , r
eststo

reg dif_pre_ce_pc soc_avg_dif  $all_cov_2 if bl_asset_rich==1 , r
eststo

reg dif_pre_ce_pc soc_avg_dif  $all_cov_2 if res_female==1 , r
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\soc_on_dif_pre_ce_pc.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



eststo clear

rreg dif_pre_ce_pc soc_avg_dif  $all_cov_2 i.zone
eststo

rreg dif_pre_ce_pc soc_avg_dif  $all_cov_2 if zone==1
eststo

rreg dif_pre_ce_pc soc_avg_dif  $all_cov_2 if zone==2
eststo

rreg dif_pre_ce_pc soc_avg_dif  $all_cov_2 if zone==3 
eststo

rreg dif_pre_ce_pc soc_avg_dif  $all_cov_2 if zone==4 
eststo

rreg dif_pre_ce_pc soc_avg_dif  $all_cov_2 if bl_asset_rich==1 
eststo

rreg dif_pre_ce_pc soc_avg_dif  $all_cov_2 if res_female==1
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\soc_on_dif_pre_ce_pc_robust.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)






eststo clear

reg a_pca_p_dif_2  soc_avg_dif  $all_cov_2 i.zone  , r
eststo

reg a_pca_p_dif_2  soc_avg_dif  $all_cov_2 if zone==1 , r
eststo

reg a_pca_p_dif_2  soc_avg_dif  $all_cov_2 if zone==2 , r
eststo

reg a_pca_p_dif_2  soc_avg_dif  $all_cov_2 if zone==3 , r
eststo

reg a_pca_p_dif_2  soc_avg_dif  $all_cov_2 if zone==4 , r
eststo

reg a_pca_p_dif_2  soc_avg_dif  $all_cov_2 if bl_asset_rich==1 , r
eststo

reg a_pca_p_dif_2  soc_avg_dif  $all_cov_2 if res_female==1 , r
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\soc_on_a_pca_p_dif_2 .rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



eststo clear

rreg a_pca_p_dif_2  soc_avg_dif  $all_cov_2 i.zone  
eststo

rreg a_pca_p_dif_2  soc_avg_dif  $all_cov_2 if zone==1 
eststo

rreg a_pca_p_dif_2  soc_avg_dif  $all_cov_2 if zone==2
eststo

rreg a_pca_p_dif_2  soc_avg_dif  $all_cov_2 if zone==3 
eststo

rreg a_pca_p_dif_2  soc_avg_dif  $all_cov_2 if zone==4 
eststo

rreg a_pca_p_dif_2  soc_avg_dif  $all_cov_2 if bl_asset_rich==1 
eststo

rreg a_pca_p_dif_2  soc_avg_dif  $all_cov_2 if res_female==1
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\soc_on_a_pca_p_dif_2_robust.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



eststo clear

probit sell_asset_bin soc_avg_dif  $all_cov i.zone  , r
eststo

probit sell_asset_bin soc_avg_dif  $all_cov if zone==1 , r
eststo

probit sell_asset_bin soc_avg_dif  $all_cov if zone==2 , r
eststo

probit sell_asset_bin soc_avg_dif  $all_cov if zone==3 , r
eststo

probit sell_asset_bin soc_avg_dif  $all_cov if zone==4 , r
eststo

probit sell_asset_bin soc_avg_dif  $all_cov if bl_asset_rich==1 , r
eststo

probit sell_asset_bin soc_avg_dif  $all_cov if res_female==1 , r
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\soc_on_sell_asset_bin.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)


******erosion

global all_cov_2: subinstr global all_cov  "a_pca_07" ""
global all_cov_2: subinstr global all_cov_2 "pre_ce_07" ""
global all_cov_2: subinstr global all_cov_2 "official_role_res" ""
global all_cov_2: subinstr global all_cov_2 "erosion_07_avg" ""


eststo clear

reg dif_pre_ce_pc erosion_avg_dif  $all_cov_2 i.zone  , r
eststo

reg dif_pre_ce_pc erosion_avg_dif  $all_cov_2 if zone==1 , r
eststo

reg dif_pre_ce_pc erosion_avg_dif  $all_cov_2 if zone==2 , r
eststo

reg dif_pre_ce_pc erosion_avg_dif  $all_cov_2 if zone==3 , r
eststo

reg dif_pre_ce_pc erosion_avg_dif  $all_cov_2 if zone==4 , r
eststo

reg dif_pre_ce_pc erosion_avg_dif  $all_cov_2 if bl_asset_rich==1 , r
eststo

reg dif_pre_ce_pc erosion_avg_dif  $all_cov_2 if res_female==1 , r
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\erosion_on_dif_pre_ce_pc.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



eststo clear

rreg dif_pre_ce_pc erosion_avg_dif  $all_cov_2 i.zone
eststo

rreg dif_pre_ce_pc erosion_avg_dif  $all_cov_2 if zone==1
eststo

rreg dif_pre_ce_pc erosion_avg_dif  $all_cov_2 if zone==2
eststo

rreg dif_pre_ce_pc erosion_avg_dif  $all_cov_2 if zone==3 
eststo

rreg dif_pre_ce_pc erosion_avg_dif  $all_cov_2 if zone==4 
eststo

rreg dif_pre_ce_pc erosion_avg_dif  $all_cov_2 if bl_asset_rich==1 
eststo

rreg dif_pre_ce_pc erosion_avg_dif  $all_cov_2 if res_female==1
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\erosion_on_dif_pre_ce_pc_robust.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



eststo clear

reg a_pca_p_dif_2  erosion_avg_dif  $all_cov_2 i.zone  , r
eststo

reg a_pca_p_dif_2  erosion_avg_dif  $all_cov_2 if zone==1 , r
eststo

reg a_pca_p_dif_2  erosion_avg_dif  $all_cov_2 if zone==2 , r
eststo

reg a_pca_p_dif_2  erosion_avg_dif  $all_cov_2 if zone==3 , r
eststo

reg a_pca_p_dif_2  erosion_avg_dif  $all_cov_2 if zone==4 , r
eststo

reg a_pca_p_dif_2  erosion_avg_dif  $all_cov_2 if bl_asset_rich==1 , r
eststo

reg a_pca_p_dif_2  erosion_avg_dif  $all_cov_2 if res_female==1 , r
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\erosion_on_a_pca_p_dif_2 .rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



eststo clear

rreg a_pca_p_dif_2  erosion_avg_dif  $all_cov_2 i.zone  
eststo

rreg a_pca_p_dif_2  erosion_avg_dif  $all_cov_2 if zone==1 
eststo

rreg a_pca_p_dif_2  erosion_avg_dif  $all_cov_2 if zone==2
eststo

rreg a_pca_p_dif_2  erosion_avg_dif  $all_cov_2 if zone==3 
eststo

rreg a_pca_p_dif_2  erosion_avg_dif  $all_cov_2 if zone==4 
eststo

rreg a_pca_p_dif_2  erosion_avg_dif  $all_cov_2 if bl_asset_rich==1 
eststo

rreg a_pca_p_dif_2  erosion_avg_dif  $all_cov_2 if res_female==1
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\erosion_on_a_pca_p_dif_2_robust.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



eststo clear

probit sell_asset_bin erosion_avg_dif  $all_cov i.zone  , r
eststo

probit sell_asset_bin erosion_avg_dif  $all_cov if zone==1 , r
eststo

probit sell_asset_bin erosion_avg_dif  $all_cov if zone==2 , r
eststo

probit sell_asset_bin erosion_avg_dif  $all_cov if zone==3 , r
eststo

probit sell_asset_bin erosion_avg_dif  $all_cov if zone==4 , r
eststo

probit sell_asset_bin erosion_avg_dif  $all_cov if bl_asset_rich==1 , r
eststo

probit sell_asset_bin erosion_avg_dif  $all_cov if res_female==1 , r
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\erosion_on_sell_asset_bin.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)






******fw_val_log_dif 


global all_cov_2: subinstr global all_cov  "a_pca_07" ""
global all_cov_2: subinstr global all_cov_2 "pre_ce_07" ""
global all_cov_2: subinstr global all_cov_2 "official_role_res" ""


eststo clear

reg dif_pre_ce_pc fw_val_log_dif  $all_cov_2 i.zone  , r
eststo

reg dif_pre_ce_pc fw_val_log_dif  $all_cov_2 if zone==1 , r
eststo

reg dif_pre_ce_pc fw_val_log_dif  $all_cov_2 if zone==2 , r
eststo

reg dif_pre_ce_pc fw_val_log_dif  $all_cov_2 if zone==3 , r
eststo

reg dif_pre_ce_pc fw_val_log_dif  $all_cov_2 if zone==4 , r
eststo

reg dif_pre_ce_pc fw_val_log_dif  $all_cov_2 if bl_asset_rich==1 , r
eststo

reg dif_pre_ce_pc fw_val_log_dif  $all_cov_2 if res_female==1 , r
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\fw_val_pre_ce_pc.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



eststo clear

rreg dif_pre_ce_pc fw_val_log_dif  $all_cov_2 i.zone
eststo

rreg dif_pre_ce_pc fw_val_log_dif  $all_cov_2 if zone==1
eststo

rreg dif_pre_ce_pc fw_val_log_dif  $all_cov_2 if zone==2
eststo

rreg dif_pre_ce_pc fw_val_log_dif  $all_cov_2 if zone==3 
eststo

rreg dif_pre_ce_pc fw_val_log_dif  $all_cov_2 if zone==4 
eststo

rreg dif_pre_ce_pc fw_val_log_dif  $all_cov_2 if bl_asset_rich==1 
eststo

rreg dif_pre_ce_pc fw_val_log_dif  $all_cov_2 if res_female==1
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\soc_on_dif_pre_ce_pc_robust.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)






eststo clear

reg a_pca_p_dif_2  fw_val_log_dif  $all_cov_2 i.zone  , r
eststo

reg a_pca_p_dif_2  fw_val_log_dif  $all_cov_2 if zone==1 , r
eststo

reg a_pca_p_dif_2  fw_val_log_dif  $all_cov_2 if zone==2 , r
eststo

reg a_pca_p_dif_2  fw_val_log_dif  $all_cov_2 if zone==3 , r
eststo

reg a_pca_p_dif_2  fw_val_log_dif  $all_cov_2 if zone==4 , r
eststo

reg a_pca_p_dif_2  fw_val_log_dif  $all_cov_2 if bl_asset_rich==1 , r
eststo

reg a_pca_p_dif_2  fw_val_log_dif  $all_cov_2 if res_female==1 , r
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\fw_val_on_a_pca_p_dif_2 .rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



eststo clear

rreg a_pca_p_dif_2  fw_val_log_dif  $all_cov_2 i.zone  
eststo

rreg a_pca_p_dif_2  fw_val_log_dif  $all_cov_2 if zone==1 
eststo

rreg a_pca_p_dif_2  fw_val_log_dif  $all_cov_2 if zone==2
eststo

rreg a_pca_p_dif_2  fw_val_log_dif  $all_cov_2 if zone==3 
eststo

rreg a_pca_p_dif_2  fw_val_log_dif  $all_cov_2 if zone==4 
eststo

rreg a_pca_p_dif_2  fw_val_log_dif  $all_cov_2 if bl_asset_rich==1 
eststo

rreg a_pca_p_dif_2  fw_val_log_dif  $all_cov_2 if res_female==1
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\fw_ac_on_a_pca_p_dif_2_robust.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



eststo clear

probit sell_asset_bin fw_val_log_dif  $all_cov i.zone  , r
eststo

probit sell_asset_bin fw_val_log_dif  $all_cov if zone==1 , r
eststo

probit sell_asset_bin fw_val_log_dif  $all_cov if zone==2 , r
eststo

probit sell_asset_bin fw_val_log_dif  $all_cov if zone==3 , r
eststo

probit sell_asset_bin fw_val_log_dif  $all_cov if zone==4 , r
eststo

probit sell_asset_bin fw_val_log_dif  $all_cov if bl_asset_rich==1 , r
eststo

probit sell_asset_bin fw_val_log_dif  $all_cov if res_female==1 , r
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\fw_on_sell_asset_bin.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)


******fw_hr_dif_log 

global all_cov_2: subinstr global all_cov  "a_pca_07" ""
global all_cov_2: subinstr global all_cov_2 "pre_ce_07" ""
global all_cov_2: subinstr global all_cov_2 "official_role_res" ""



eststo clear

reg dif_pre_ce_pc fw_hr_dif_log  $all_cov_2 i.zone  , r
eststo

reg dif_pre_ce_pc fw_hr_dif_log  $all_cov_2 if zone==1 , r
eststo

reg dif_pre_ce_pc fw_hr_dif_log  $all_cov_2 if zone==2 , r
eststo

reg dif_pre_ce_pc fw_hr_dif_log  $all_cov_2 if zone==3 , r
eststo

reg dif_pre_ce_pc fw_hr_dif_log  $all_cov_2 if zone==4 , r
eststo

reg dif_pre_ce_pc fw_hr_dif_log  $all_cov_2 if bl_asset_rich==1 , r
eststo

reg dif_pre_ce_pc fw_hr_dif_log  $all_cov_2 if res_female==1 , r
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\fw_time_on_dif_pre_ce_pc.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



eststo clear

rreg dif_pre_ce_pc fw_hr_dif_log  $all_cov_2 i.zone
eststo

rreg dif_pre_ce_pc fw_hr_dif_log  $all_cov_2 if zone==1
eststo

rreg dif_pre_ce_pc fw_hr_dif_log  $all_cov_2 if zone==2
eststo

rreg dif_pre_ce_pc fw_hr_dif_log  $all_cov_2 if zone==3 
eststo

rreg dif_pre_ce_pc fw_hr_dif_log  $all_cov_2 if zone==4 
eststo

rreg dif_pre_ce_pc fw_hr_dif_log  $all_cov_2 if bl_asset_rich==1 
eststo

rreg dif_pre_ce_pc fw_hr_dif_log  $all_cov_2 if res_female==1
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\erosion_on_dif_pre_ce_pc_robust.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



eststo clear

reg a_pca_p_dif_2  fw_hr_dif_log  $all_cov_2 i.zone  , r
eststo

reg a_pca_p_dif_2  fw_hr_dif_log  $all_cov_2 if zone==1 , r
eststo

reg a_pca_p_dif_2  fw_hr_dif_log  $all_cov_2 if zone==2 , r
eststo

reg a_pca_p_dif_2  fw_hr_dif_log  $all_cov_2 if zone==3 , r
eststo

reg a_pca_p_dif_2  fw_hr_dif_log  $all_cov_2 if zone==4 , r
eststo

reg a_pca_p_dif_2  fw_hr_dif_log  $all_cov_2 if bl_asset_rich==1 , r
eststo

reg a_pca_p_dif_2  fw_hr_dif_log  $all_cov_2 if res_female==1 , r
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\erosion_on_a_pca_p_dif_2 .rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



eststo clear

rreg a_pca_p_dif_2  fw_hr_dif_log  $all_cov_2 i.zone  
eststo

rreg a_pca_p_dif_2  fw_hr_dif_log  $all_cov_2 if zone==1 
eststo

rreg a_pca_p_dif_2  fw_hr_dif_log  $all_cov_2 if zone==2
eststo

rreg a_pca_p_dif_2  fw_hr_dif_log  $all_cov_2 if zone==3 
eststo

rreg a_pca_p_dif_2  fw_hr_dif_log  $all_cov_2 if zone==4 
eststo

rreg a_pca_p_dif_2  fw_hr_dif_log  $all_cov_2 if bl_asset_rich==1 
eststo

rreg a_pca_p_dif_2  fw_hr_dif_log  $all_cov_2 if res_female==1
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\erosion_on_a_pca_p_dif_2_robust.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)



eststo clear

probit sell_asset_bin fw_hr_dif_log  $all_cov i.zone  , r
eststo

probit sell_asset_bin fw_hr_dif_log  $all_cov if zone==1 , r
eststo

probit sell_asset_bin fw_hr_dif_log  $all_cov if zone==2 , r
eststo

probit sell_asset_bin fw_hr_dif_log  $all_cov if zone==3 , r
eststo

probit sell_asset_bin fw_hr_dif_log  $all_cov if zone==4 , r
eststo

probit sell_asset_bin fw_hr_dif_log  $all_cov if bl_asset_rich==1 , r
eststo

probit sell_asset_bin fw_hr_dif_log  $all_cov if res_female==1 , r
eststo

esttab using "C:\Users\khughes\Documents\Active Projects\SPIA-Vi\Analysis\April 17\estout_tables\fw_on_sell_asset_bin.rtf", se r modelwidth(2) b(a2) starl(* 0.1 ** 0.05 *** 0.01)


set more off
stepwise, pr (.1): reg fw_hr_dif_log $all_cov_2 if exp_shock_sig==1, r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_fw_hr_dif_log"`X'"

set more off
stepwise, pr (.1): reg fw_hr_dif_log $all_cov_2 if res_female==1 & exp_shock_sig==1, r  
indeplist, local 
*create global for shortlisted (sl) variables 
gl cov_fw_hr_dif_log_f"`X'"


sem (fw_hr_dif_log <- prog_area  $sl_cov_shock samp_z_1 samp_z_2 samp_z_3 ) (sell_asset_bin <- fw_hr_dif_log prog_area $sl_cov_shock $cov_fw_hr_dif_log  samp_z_1 samp_z_2 samp_z_3 ) , vce(cluster groupid) nocapslatent
estat teffects


sem (fw_hr_dif_log <- prog_area  $sl_cov_shock_f samp_z_1 samp_z_2 samp_z_3 ) (sell_asset_bin <- fw_hr_dif_log prog_area $sl_cov_shock_f $cov_fw_hr_dif_log_f samp_z_1 samp_z_2 samp_z_3 ) if res_female==1 , vce(cluster groupid) nocapslatent
estat teffects

sem (fw_hr_dif_log <- prog_area  $all_cov ) (sell_asset_bin <- fw_hr_dif_log prog_area $all_cov   ) if zone==2 , vce(cluster groupid) nocapslatent
estat teffects
